Error: running webpack failed

Hi!

updating on one of our machines, trying to build-assets for core – that currently is at:

commit 54dcd5c746ba5cae0043f3f38565367bc8438ddd
Author: Adrian Moennich adrian.moennich@cern.ch
Date: Thu Jan 9 12:07:49 2020 +0100

Split editing backend controllers.py

I get this error:

src]$ ./bin/maintenance/build-assets.py indico --dev
**CopyPlugin Invalid Options**
**options.0 should be string**
**options.0.transform should pass "instanceof" keyword validation**
**options.0 should match some schema in anyOf**
**options.1 should be string**
**options.1.transform should pass "instanceof" keyword validation**
**options.1 should match some schema in anyOf**
**ValidationError: CopyPlugin Invalid Options**
**at validateOptions (/data/opt/indico/src/node_modules/schema-utils/src/validateOptions.js:32:11)**
**at new CopyPlugin (/data/opt/indico/src/node_modules/copy-webpack-plugin/dist/index.js:26:30)**
**at _default (/data/opt/indico/src/webpack.config.babel.js:134:7)**
**at handleFunction (/data/opt/indico/src/node_modules/webpack-cli/bin/utils/prepareOptions.js:21:13)**
**at prepareOptions (/data/opt/indico/src/node_modules/webpack-cli/bin/utils/prepareOptions.js:9:5)**
**at requireConfig (/data/opt/indico/src/node_modules/webpack-cli/bin/utils/convert-argv.js:117:14)**
**at /data/opt/indico/src/node_modules/webpack-cli/bin/utils/convert-argv.js:123:17**
**at Array.forEach (<anonymous>)**
**at module.exports (/data/opt/indico/src/node_modules/webpack-cli/bin/utils/convert-argv.js:121:15)**
**at yargs.parse (/data/opt/indico/src/node_modules/webpack-cli/bin/cli.js:71:45)**
**at Object.parse (/data/opt/indico/src/node_modules/webpack-cli/node_modules/yargs/yargs.js:567:18)**
**at /data/opt/indico/src/node_modules/webpack-cli/bin/cli.js:49:8**
**at Object.<anonymous> (/data/opt/indico/src/node_modules/webpack-cli/bin/cli.js:366:3)**
**at Module._compile (internal/modules/cjs/loader.js:701:30)**
**at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)**
**at Module.load (internal/modules/cjs/loader.js:600:32)**
**at tryModuleLoad (internal/modules/cjs/loader.js:539:12)**
**at Function.Module._load (internal/modules/cjs/loader.js:531:3)**
**at Module.require (internal/modules/cjs/loader.js:637:17)**
**at require (internal/modules/cjs/helpers.js:22:18)**
**at Object.<anonymous> (/data/opt/indico/src/node_modules/webpack/bin/webpack.js:156:2)**
**at Module._compile (internal/modules/cjs/loader.js:701:30)**
**at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)**
**at Module.load (internal/modules/cjs/loader.js:600:32)**
**at tryModuleLoad (internal/modules/cjs/loader.js:539:12)**
**at Function.Module._load (internal/modules/cjs/loader.js:531:3)**
**at Function.Module.runMain (internal/modules/cjs/loader.js:754:12)**
**at findNodeScript.then.existing (/usr/local/lib/nodejs/lib/node_modules/npm/node_modules/libnpx/index.js:268:14)**
**Error: running webpack failed**

Any ideas?! (Note that doing same for plugin is fine.)

Many thanks! mario

Run npm ci to install the correct versions of all the node dependencies.

Are you sure you want to work on master and on 2.2-maintenance for now? I don’t remember if we discussed it at some point… but if you want/need react everywhere, master (2.3) makes sense, otherwise 2.2 is the better choice.

Running npm ci then build-assets again gives same error…

This is a dev instance, so not taking too much care for now about stable versions. But yes, that should be taken into consideration :wink:

Did you change anything in the webpack config or package.json / package-lock.json? Because I used npm ci just this morning and had no problems building assets afterwards (on master).

Yeah, I can also confirm that webpack build works fine and no problems occur.

Thanks… no changes to package.json, or to webpack conf. Still failing, but strangely it seems to be failing independently of which commit i am at (for core) – also on my local dev instance. I have been able to get the right sequence of commands to get build-assets to run without reporting a failure, but then there is a jquery error in the UI (login fails). Seems something in the env has changed, but do not see what it is as yet.

So, when the web is restarted, home page loads ok, then moving to login page gives this js error in the chrome console (and clicking on [Login with Indico] goes nowhere) :

(index):159 Uncaught ReferenceError: $ is not defined
at (index):159
at (index):184
(anonymous) @ (index):159
(anonymous) @ (index):184

[DOM] Input elements should have autocomplete attributes (suggested: “current-password”): (More info: https://goo.gl/9p2vKq) <input id=​"password" name=​"password" placeholder=​"Password" required type=​"password" value>​

where line 159 in the login page is;
$(’.login-page’).on(‘click’, ‘.i-button.login-form-button’, function() {

Any ideas why jquery is not being loaded here?

And, for additional info (so, version corresponds to what package.json states):

$ npm list jquery
indico@2.0.0 /src
├── jquery@3.4.1
├─┬ jquery-colorbox@1.6.4
│ └── jquery@3.4.1 deduped
├─┬ jquery-form@4.2.2
│ └── jquery@3.4.1 deduped
├─┬ jquery-typeahead@2.11.0
│ └── jquery@3.4.1 deduped
├─┬ qtip2@3.0.3 (github:indico/qTip2#8951e5538a5c0833021b2d2b5d8a587a2c24faae)
│ └── jquery@3.4.1 deduped
├─┬ tablesorter@2.31.1
│ └── jquery@3.4.1 deduped
└─┬ vanderlee-colorpicker@1.2.16
└── jquery@3.4.1 deduped

Known issue in master, we still have to fix this.

OK. But if I reset core on v2.2.5 (on master), there is still other issues e.g. (in src)

$ git reset --hard v2.2.5
$ rm -rf node_modules
$ pip install -r requirements.txt
$ npm clean-install
$ npm list jquery webpack webpack-cli 
$ npm list jquery webpack webpack-cli
indico@2.0.0 <indico>/src
├── jquery@3.4.1 
├─┬ jquery-colorbox@1.6.4
│ └── jquery@3.4.1 deduped
├─┬ jquery-form@4.2.2
│ └── jquery@3.4.1 deduped
├─┬ jquery-typeahead@2.10.6
│ └── jquery@3.4.1 deduped
├─┬ UNMET DEPENDENCY qtip2@github:indico/qTip2#8951e5538a5c0833021b2d2b5d8a587a2c24faae
│ └── jquery@3.4.1 deduped
├─┬ tablesorter@2.31.1
│ └── jquery@3.4.1 deduped
├─┬ vanderlee-colorpicker@1.2.16
│ └── jquery@3.4.1 deduped
├── webpack@4.36.1 
└── webpack-cli@3.3.6

If I then do:

$ npm install qtip2
npm WARN leaflet.markercluster@1.4.1 requires a peer of leaflet@~1.3.1 but none is installed. You must install peer dependencies yourself.
+ qtip2@3.0.3
updated 6 packages and audited 16154 packages in 21.264s
found 5 vulnerabilities (1 **low** , 3 moderate, 1 high)
run `npm audit fix` to fix them, or `npm audit` for details

Running audit fix seems to fix them… but, all this makes me wonder what possible other problems may be still unflagged?!

The security warnings are usually harmless - they are usually in code that is not used on the client side (e.g. build-time code, where XSS is obviously not a problem). In any case, we update all the dependencies in each major (2.1, 2.2, 2.3, etc.) update.

The peer dependency warning can be ignored as well.