Flood-UI / flood

A web UI for rTorrent, qBittorrent and Transmission with a Node.js backend and React frontend. Migrate to v4: https://github.com/jesec/flood/wiki/Migrate-from-older-versions-of-Flood.
https://flood.js.org
GNU General Public License v3.0
1.81k stars 173 forks source link

npm run build fails #533

Closed noraj closed 5 years ago

noraj commented 6 years ago
$ sudo npm run build                                                                                                                                                              shark@rawsec

> flood@1.0.0 build /srv/flood
> node client/scripts/build.js

Creating an optimized production build...
Failed to compile.

./client/src/sass/style.scss
Module build failed: Error: ENOENT: no such file or directory, scandir '/srv/flood/node_modules/node-sass/vendor'

./client/src/sass/style.scss
Module build failed: ModuleBuildError: Module build failed: Error: ENOENT: no such file or directory, scandir '/srv/flood/node_modules/node-sass/vendor'

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! flood@1.0.0 build: `node client/scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the flood@1.0.0 build 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!     /root/.npm/_logs/2017-11-11T17_49_10_048Z-debug.log

/root/.npm/_logs/2017-11-11T17_49_10_048Z-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm@5.5.1
3 info using node@v8.8.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle flood@1.0.0~prebuild: flood@1.0.0
6 info lifecycle flood@1.0.0~build: flood@1.0.0
7 verbose lifecycle flood@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle flood@1.0.0~build: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/srv/flood/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
9 verbose lifecycle flood@1.0.0~build: CWD: /srv/flood
10 silly lifecycle flood@1.0.0~build: Args: [ '-c', 'node client/scripts/build.js' ]
11 silly lifecycle flood@1.0.0~build: Returned: code: 1  signal: null
12 info lifecycle flood@1.0.0~build: Failed to exec build script
13 verbose stack Error: flood@1.0.0 build: `node client/scripts/build.js`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at EventEmitter.emit (events.js:213:7)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:125:13)
13 verbose stack     at ChildProcess.emit (events.js:213:7)
13 verbose stack     at maybeClose (internal/child_process.js:927:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
14 verbose pkgid flood@1.0.0
15 verbose cwd /srv/flood
16 verbose Linux 3.14.32-xxxx-grs-ipv6-64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v8.8.1
19 verbose npm  v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error flood@1.0.0 build: `node client/scripts/build.js`
22 error Exit status 1
23 error Failed at the flood@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
$ node --version
v8.8.1
$ npm --version
5.5.1
$ node-gyp --version
v3.6.2
noraj commented 6 years ago

I figured that node_modules/node-sass/ was containing:

$ ls -1 node_modules/node-sass/
bin
binding.gyp
CHANGELOG.md
lib
LICENSE
node_modules
package.json
README.md
scripts
src
test

Where it should look like:

$ ls -1 node_modules/node-sass
bin
binding.gyp
CHANGELOG.md
lib
LICENSE
package.json
README.md
scripts
src
test
vendor

So I re-installed it:

$ sudo npm i node-sass --python="/usr/bin/python2" --unsafe-perm

> node-sass@4.6.1 install /srv/flood/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.6.1/linux-x64-57_binding.node
Download complete..] - :
Binary saved to /srv/flood/node_modules/node-sass/vendor/linux-x64-57/binding.node
Caching binary to /root/.npm/node-sass/4.6.1/linux-x64-57_binding.node

> node-sass@4.6.1 postinstall /srv/flood/node_modules/node-sass
> node scripts/build.js

Binary found at /srv/flood/node_modules/node-sass/vendor/linux-x64-57/binding.node
Testing binary
Binary is fine
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ node-sass@4.6.1
updated 2 packages in 77.044s

And now the directory seems normal:

$ ls -1 node_modules/node-sass 
bin
binding.gyp
CHANGELOG.md
lib
LICENSE
node_modules
package.json
README.md
scripts
src
test
vendor

And now it works

$ sudo npm run build

> flood@1.0.0 build /srv/flood
> node client/scripts/build.js

Creating an optimized production build...
Compiled successfully.

File sizes after gzip:

  396.88 KB (-521 B)  assets/static/js/main.7a1176c2.js
  16.21 KB            assets/static/css/main.ebb9e2e6.css

Hope it can help someone.

noraj commented 6 years ago

@jfurrow by the way : flood ask for node-sass 4.5.3+ and when reinstalling I installed node-sass last version that is 4.6.1. By seeing tags change-log I saw that 4.6.0 brought nodejs 9 support. So if we want to support nodejs 9 we need to update the package.json. See PR #534

That's why my problem was solved because I was running nodejs 8.8.1 and I checked that node-sass@4.5.3 is normally containing vendor. So that's mysterious.

noraj commented 6 years ago

Another error that can happen when having an outdated node-sass:

npm run build

> flood@1.0.0 build /srv/flood
> node client/scripts/build.js

Creating an optimized production build...
Failed to compile.

./client/src/sass/style.scss
Module build failed: Error: Missing binding /srv/flood/node_modules/node-sass/vendor/linux-x64-59/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 9.x

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

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.

./client/src/sass/style.scss
Module build failed: ModuleBuildError: Module build failed: Error: Missing binding /srv/flood/node_modules/node-sass/vendor/linux-x64-59/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 9.x

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

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass --force` to build the binding for your current environment.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! flood@1.0.0 build: `node client/scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the flood@1.0.0 build 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/flood/.npm/_logs/2017-11-26T23_30_01_613Z-debug.log
noraj commented 5 years ago

Outdated node-sass again. #768