Build-assets.py (node_modules) errors: Module not found: Can't resolve


#1

Hello!

am installing an Indico instance on a clean Centos server, primarily for testing. Failure seems to be related to generation of node_modules with node, webpack etc. Here’s the installed versions of some of these key components:

$ cat /etc/centos-release 
CentOS Linux release 7.6.1810 (Core) 
$ which node npm npx webpack
/usr/local/lib/nodejs/bin/node
/usr/local/lib/nodejs/bin/npm
/usr/local/lib/nodejs/bin/npx
/data/opt/indico/src/node_modules/.bin/webpack
$ node -v; npm -v; npx -v; webpack -v;
v10.15.3
6.4.1
6.4.1
4.30.0
$ npm list webpack webpack-cli
indico@2.0.0 /data/opt/indico/src
├── webpack@4.30.0 
└── webpack-cli@3.3.2

But build-assets.py for indico fails – here’s extracts of the log output (running in indico src dir) :

$ ./bin/maintenance/build-assets.py indico --dev
**Build completed in 75.102s**
Hash: **8370a46947386a9846a9**
Version: webpack **4.30.0**
Time: **75132** ms
Built at: 05/07/2019 **6:05:27 PM**
Entrypoint **jquery** = **js/common.bfd2302b.bundle.js** **css/common.c4af58b1.css** **js/common.bfd2302b.bundle.js.map** **css/common.c4af58b1.css.map** **js/jquery.75d08a90.bundle.js** **css/jquery.80af9ee4.css** **js/jquery.75d08a90.bundle.js.map** **css/jquery.80af9ee4.css.map**

<<< LOTS more OK output as above... >>>

chunk { **themes_standard_inline_minutes.print** } **js/themes_standard_inline_minutes.print.4a1306fa.bundle.js, css/themes_standard_inline_minutes.print.5cd5dd67.css, js/themes_standard_inline_minutes.print.4a1306fa.bundle.js.map, css/themes_standard_inline_minutes.print.5cd5dd67.css.map** (themes_standard_inline_minutes.print) 41 bytes ={ **common** }= **[entry]** **[rendered]**

**ERROR in /data/opt/indico/src/node_modules/@babel/polyfill/lib/noConflict.js**
**Module not found: Error: Can't resolve 'core-js/es6' in '/data/opt/indico/src/node_modules/@babel/polyfill/lib'**
 **@ /data/opt/indico/src/node_modules/@babel/polyfill/lib/noConflict.js 3:0-22**
 **@ /data/opt/indico/src/node_modules/@babel/polyfill/lib/index.js**
 **@ ./js/index.js**
 **@ multi ./js/index.js**

<<< About 30 similar other ERRORS as above ... then ending with: >>>

**Error: running webpack failed**
$ 

For some possibly additional info, concerning 1st error message I include here:

$ npm list core-js
indico@2.0.0 /data/opt/indico/src
├─┬ @babel/polyfill@7.4.4
│ └── core-js@2.6.5 
├─┬ @babel/preset-env@7.4.4
│ └─┬ core-js-compat@3.0.1
│   └── core-js@3.0.1  deduped
├─┬ @babel/register@7.4.4
│ └── core-js@3.0.1  deduped
├── core-js@3.0.1 
├─┬ react-dates@20.1.0
│ └─┬ react-addons-shallow-compare@15.6.2
│   └─┬ fbjs@0.8.17
│     └── core-js@1.2.7 
└─┬ react-virtualized@9.21.0
  └─┬ babel-runtime@6.26.0
    └── core-js@2.6.5 

Would anyone have any insight as to what might be breaking here?

Many thanks!

Mario


#2

Please use 2.1 (which is what pip install indico gives you), and make sure to use the ‘stable’ docs (not ‘latest’).

2.2 is still under development and hasn’t been officially released yet.


#3

Thanks. But this is for development, and this server needs to serve as a testing/demo instance with newly committed code changes for the UNOG extensions implementation. Any ideas why node/webpack are failing here?


#4

Ah sorry, didn’t realize you’re UNOG and thus doing development when reading your initial message!

So for installing on a test server where you don’t do development you should ideally build a wheel locally (e.g. on your dev system) and just install the wheel on the server (like you would do in a production setup).

Anyway, they error you’re getting is strange and we’ll look into it…


#5

Could you try reinstalling the node_modules?

rm -rf node_modules package-lock.json
npm install

Ideally do this on the latest master, since I just updated all the JS dependencies (and I did test building the assets from the same state, ie no package-lock.json nor existing node_modules, which worked fine for me)


#6

Ok, doing this (and then updating copy of CERN Indico fork on this server) has corrected the above errors i.e.
$ ./bin/maintenance/build-assets.py indico --dev
executes with no errors