Skip to content

webapp: Following getting started fails with node dependencies error

Regarding the webapp, following the getting started on a new machine results is not enough:

sudo apt install nodejs npm
cd swh-web
npm install

This result in an error about node dependencies:

$ make build-webpack-dev

...

ERROR in ./node_modules/bootstrap-loader/no-op.js (./node_modules/cache-loader/dist/cjs.js!./node_modules/css-loader?sourceMap!./node_modules/postcss-loader/src?sourceMap!./node_modules/resolve-url-loader!./node_modules/sass-loader/lib/loader.js?sourceMap!./node_modules/bootstrap-loader/lib/bootstrap.styles.loader.js?{ "bootstrapVersion":4,"preBootstrapCustomizations": "/home/tony/work/inria/repo/swh/swh-environment/swh-web/swh/web/assets/config/bootstrap-pre-custom   ize.scss","appStyles": "/home/tony/work/inria/repo/swh/swh-environment/swh-web/node_modules/admin-lte/build/scss/AdminLTE-raw.scss","extractStyles":true,"styleLoaders": ["cache-loader","css-loader?sourceMap","postcss-loader?sourceMap","sass-loader?sourceMap"],"styles": ["mixins","print","buttons","code","forms","grid","images","reboot","tables","type","alert","badge","breadcrumb","button-group","card","close","custom-forms","dropdown","input-group","jumbotron","list-group","media","nav","navbar","pagination","progress","transitions","carousel","modal","popover","tooltip","utilities"],"scripts": ["alert","button","carousel","collapse","dropdown","modal","popover","scrollspy","tab","tooltip","util"],"configFilePath": "/home/tony/work/inria/repo/swh/swh-environment/swh-web/swh/web/assets/config/.bootstraprc","bootstrapPath": "/home/tony/work/inria/repo/swh/swh-environment/swh-web/node_modules/bootstrap","bootstrapRelPath": "../bootstrap"}!./node_modules/bootstrap-loader/no-op.js)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Missing binding /home/tony/work/inria/repo/swh/swh-environment/swh-web/node_modules/node-sass/vendor/linux-x64-57/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 8.x

Found bindings for the following environments:
- Linux 64-bit with Node.js 10.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
at module.exports (/home/tony/work/inria/repo/swh/swh-environment/swh-web/node_modules/node-sass/lib/binding.js:15:13)
at Object.<anonymous> (/home/tony/work/inria/repo/swh/swh-environment/swh-web/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (/home/tony/work/inria/repo/swh/swh-environment/swh-web/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (/home/tony/work/inria/repo/swh/swh-environment/swh-web/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.sassLoader (/home/tony/work/inria/repo/swh/swh-environment/swh-web/node_modules/sass-loader/lib/loader.js:46:72)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! swh-web@0.0.1 build-dev: `NODE_ENV=development webpack --config ./swh/web/assets/config/webpack.config.development.js  --display-modules --progress --colors`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the swh-web@0.0.1 build-dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/tony/.npm/_logs/2018-09-17T10_31_07_962Z-debug.log
make: *** [Makefile.local:3: build-webpack-dev] Error 2

According to this log, we need at least 10.x: And indeed, in debian testing, i'm currently at 8:

$ node --version
v8.11.2
$ dpkg -l nodejs | grep nodejs
ii  nodejs                                    8.11.2~dfsg-1             amd64                     evented I/O for V8 javascript$

Checking further, all debian sources are at best at that version 8.11

  • [1].

The official documentation [2] proposes the use of a shell script:

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs

Or, next best thing, use of the official debian repository [3] (which like i said are late).

Checking further and notably the swh-web readme, there is a manual approach referenced which sounds better [4] [5].

Basically, i had to add a public key (nodesource's package signing key)

https://deb.nodesource.com/gpgkey/nodesource.gpg.key

and edited a file /etc/apt/sources.list.d/nodesource.list:

deb https://deb.nodesource.com/node10.x buster main

Then:

sudo apt update
sudo apt install -y nodejs

Note: No need for npm in this case, it comes from that nodejs package.

And now, everything worked as documented.

Cheers,


Migrated from T1198 (view on Phabricator)

Edited by Phabricator Migration user
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information