Skip to content
This repository was archived by the owner on May 31, 2021. It is now read-only.

npm run build fails #533

Closed
noraj opened this issue Nov 11, 2017 · 4 comments · Fixed by #768
Closed

npm run build fails #533

noraj opened this issue Nov 11, 2017 · 4 comments · Fixed by #768

Comments

@noraj
Copy link
Contributor

noraj commented Nov 11, 2017

$ sudo npm run build                                                                                                                                                              shark@rawsec

> [email protected] 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! [email protected] build: `node client/scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] 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 [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [email protected]~prebuild: [email protected]
6 info lifecycle [email protected]~build: [email protected]
7 verbose lifecycle [email protected]~build: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~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 [email protected]~build: CWD: /srv/flood
10 silly lifecycle [email protected]~build: Args: [ '-c', 'node client/scripts/build.js' ]
11 silly lifecycle [email protected]~build: Returned: code: 1  signal: null
12 info lifecycle [email protected]~build: Failed to exec build script
13 verbose stack Error: [email protected] 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 [email protected]
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 [email protected] build: `node client/scripts/build.js`
22 error Exit status 1
23 error Failed at the [email protected] 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
Copy link
Contributor Author

noraj commented Nov 12, 2017

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

> [email protected] 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

> [email protected] 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: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ [email protected]
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

> [email protected] 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 noraj closed this as completed Nov 12, 2017
@noraj
Copy link
Contributor Author

noraj commented Nov 12, 2017

@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 [email protected] is normally containing vendor. So that's mysterious.

@noraj
Copy link
Contributor Author

noraj commented Nov 26, 2017

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

npm run build

> [email protected] 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! [email protected] build: `node client/scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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
Copy link
Contributor Author

noraj commented Mar 6, 2019

Outdated node-sass again. #768

@noraj noraj reopened this Mar 6, 2019
noraj added a commit that referenced this issue Mar 6, 2019
@noraj noraj mentioned this issue Mar 6, 2019
jfurrow pushed a commit that referenced this issue Mar 17, 2019
* update node-sass

fix #533

* Update package-lock.json
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant