akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
956 stars 517 forks source link

yarn run webpack fails on fresh 3.2 installation #12698

Open marcoveeneman opened 4 years ago

marcoveeneman commented 4 years ago

:bug: I'm reporting a Bug :bug:

Hi, i'm trying to install the latest version of akeneo 3.2 as described on this page, without any modifications. Everything seems to be fine until i run yarn run webpack. When run, it gives the following output:

yarn run v1.22.5
$ yarn requirements && NODE_PATH=node_modules webpack --config $npm_package_config_source/webpack.config.js --env=prod
$ node $npm_package_config_source/frontend/build/check-requirements.js
Checking PIM frontend requirements
Starting webpack from /data/web/build/src in prod mode
Executing pre-build scripts
(node:8043) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
$ node $npm_package_config_styles
$ node $npm_package_config_source/frontend/build/update-extensions.js
Updating form extensions.json

Starting LESS compilation

‣ vendor/akeneo/pim-community-dev/src/Oro/Bundle/PimDataGridBundle/Resources/public/less/index.less
‣ vendor/akeneo/pim-community-dev/src/Akeneo/Platform/Bundle/UIBundle/Resources/public/less/index.less

✓ Saved CSS to web/css/pim.css
Version: webpack 4.29.6
Time: 29633ms
Built at: 09/08/2020 7:09:36 PM
 2 assets
Entrypoint main = vendor.min.js main.min.js

ERROR in /data/web/build/src/web/bundles/pimdatagrid/js/datagrid/column-selector.ts
./web/bundles/pimdatagrid/js/datagrid/column-selector.ts
[tsl] ERROR in /data/web/build/src/web/bundles/pimdatagrid/js/datagrid/column-selector.ts(466,5)
      TS2322: Type 'Partial<{ [name: string]: Column; }>' is not assignable to type '{ [name: string]: Column; }'.
  Index signatures are incompatible.
    Type 'Column | undefined' is not assignable to type 'Column'.
      Type 'undefined' is not assignable to type 'Column'.

ERROR in /data/web/build/src/web/bundles/pimui/js/view/base.ts
./web/bundles/pimui/js/view/base.ts
[tsl] ERROR in /data/web/build/src/web/bundles/pimui/js/view/base.ts(94,28)
      TS2538: Type 'undefined' cannot be used as an index type.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Something is going wrong with webpack, but i have actually no clue what's going on here. Any idea what could be going wrong and how to solve it?

System ```console cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" ``` ```console php -v PHP 7.2.30-1hypernode20200420.033518 (cli) (built: Apr 19 2020 07:47:19) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with the ionCube PHP Loader + ionCube24 v10.3.8, Copyright (c) 2002-2019, by ionCube Ltd. with Zend OPcache v7.2.30-1hypernode20200420.033518, Copyright (c) 1999-2018, by Zend Technologies ``` ```console node -v v10.22.0 ``` ```console yarn -v 1.22.5 ```
marcoveeneman commented 4 years ago

I just noticed that the download link for getting the latest version is getting an archive with akeneo 3.2.34 instead of 3.2.69, could this be related?

jmleroux commented 4 years ago

Hello @marcoveeneman ,

Nope, it's not related. I will check with the teams to know why we don't have the last 3.2 release to download.

For the Yarn issue, something must have change recently: all our nightly builds went red today.

Regards, JM

EtheranNebel commented 4 years ago

I have the same bug for an installation this morning, with v3.2.69 and v3.2.58

jmleroux commented 4 years ago

Fixed by #12706 and https://github.com/akeneo/pim-community-standard/pull/1386

EtheranNebel commented 4 years ago

Is the bug corrected in v3.2.70? I still have the same problem after upgrade.

Zzareb commented 4 years ago

I still encounter the error while compiling assets for 3.1.18 and 3.1.2, the packages used are presumably used as well. How could I fix this ?

[EDIT]

This could help someone : yarn add @types/underscore@1.8.3

maximuspoder commented 4 years ago

Any solution? It didn't work for my Akeneo...

And what's even worst than that is even though after trying to upgrade from 3.2 to 4.0 it has just broken our database... if wasn't for the backup that I did before it would have screwed all our Akeneo.

BenoitBalliu1 commented 4 years ago

Also having this webpack issue on a new akeneo Docker install. The above mentioned fix does not work for my install.

stefaanneyts commented 4 years ago

We had exactly the same issue. The versions of some of the dependencies are not pinned on a specific version, while others are. This caused compatibility issues, and will again cause compatibility issues in the future.

At this moment, changing two dependencies fixes the webpack issues: typescript and underscore.

yarn add typescript@3.6.5 @types/underscore@1.8.3

The versions in this command are very important. Typescript must be pinned at 3.6.5 because that's the "tag-for-publishing-older-releases". And @types/underscore must be pinned at 1.8.3, which is the version of the types/underscore in the package.json.

BenoitBalliu1 commented 4 years ago

After multiple tries (Centos 8) gave up and installed on Ubuntu 18.04 - Error never showed up on fresh docker install of version 4.0.70

nei commented 3 years ago

I've managed go a bit far with your solution @stefaanneyts but still some errors on 3.2.27

✓ Saved CSS to web/css/pim.css
Version: webpack 4.29.6
Time: 14202ms
Built at: 03/09/2021 3:06:47 AM
 2 assets
Entrypoint main = vendor.min.js main.min.js

ERROR in /var/www/html/staging/releases/1615231581/web/bundles/pimui/js/view/base.ts
./web/bundles/pimui/js/view/base.ts
[tsl] ERROR in /var/www/html/staging/releases/1615231581/web/bundles/pimui/js/view/base.ts(193,3)
      TS2416: Property 'render' in type 'BaseView' is not assignable to the same property in base type 'View'.
  Type '() => View' is not assignable to type '() => this'.

ERROR in /var/www/html/staging/releases/1615231581/web/bundles/pimui/js/view/base.ts
./web/bundles/pimui/js/view/base.ts
[tsl] ERROR in /var/www/html/staging/releases/1615231581/web/bundles/pimui/js/view/base.ts(193,3)
      TS2416: Property 'render' in type 'BaseView' is not assignable to the same property in base type 'View<any>'.
  Type '() => View' is not assignable to type '() => this'.
    Type 'View' is not assignable to type 'this'.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
nei commented 3 years ago

I've managed to fix mine, after running @stefaanneyts commands I did locked backbone as well as suggested here https://github.com/akeneo/pim-community-dev/issues/13895