yarnpkg/yarn

Fail on node-sass post-install commands

Closed this issue ยท 27 comments

Grawl commented

Do you want to request a feature or report a bug?

A bug.

What is the current behavior?

Yarn cannot install node-sass package.

Log

$ yarn
yarn install v0.15.1
info No lockfile found.
[1/4] ๐Ÿ”  Resolving packages...
warning gulp > vinyl-fs > glob-stream > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp-buffer > through2 > xtend > object-keys@0.4.0: 
warning gulp > vinyl-fs > glob-watcher > gaze > globule > minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp > vinyl-fs > glob-watcher > gaze > globule > glob > graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning browser-sync > localtunnel > request > tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
warning gulp-imagemin > imagemin-jpegtran > exec-buffer > execa > cross-spawn-async@2.2.4: cross-spawn no longer requires a build toolchain, use it instead!
[2/4] ๐Ÿšš  Fetching packages...
warning lodash@1.0.2: The engine "rhino" appears to be invalid.
warning benchmark@1.0.0: The engine "rhino" appears to be invalid.
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Building fresh packages...
[1/4] โ  gifsicle
[2/4] โ  jpegtran-bin
[3/4] โ  optipng-bin
[4/4] โ  node-sass
error /Users/grawl/Sites/jew-simulator/node_modules/node-sass: Command failed.
Exit code: 1
Command: sh
Arguments: -c node scripts/install.js
Directory: /Users/grawl/Sites/jew-simulator/node_modules/node-sass
Output:
module.js:457
    throw err;
    ^

Error: Cannot find module 'stringstream'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/grawl/Sites/jew-simulator/node_modules/request/request.js:15:20)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at SpawnError (/Users/grawl/.yarn/lib/errors.js:18:1)
    at ChildProcess.proc.on.code (/Users/grawl/.yarn/lib/util/child.js:107:15)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:493:12)
info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.
$ yarn
yarn install v0.15.1
info No lockfile found.
[1/4] ๐Ÿ”  Resolving packages...
warning gulp > vinyl-fs > glob-stream > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp-buffer > through2 > xtend > object-keys@0.4.0: 
warning gulp > vinyl-fs > glob-watcher > gaze > globule > minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp > vinyl-fs > glob-watcher > gaze > globule > glob > graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning browser-sync > localtunnel > request > tough-cookie@2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
warning gulp-imagemin > imagemin-jpegtran > exec-buffer > execa > cross-spawn-async@2.2.4: cross-spawn no longer requires a build toolchain, use it instead!
[2/4] ๐Ÿšš  Fetching packages...
warning lodash@1.0.2: The engine "rhino" appears to be invalid.
warning benchmark@1.0.0: The engine "rhino" appears to be invalid.
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Building fresh packages...
[1/4] โ  gifsicle
[2/4] โ  jpegtran-bin
[3/4] โ  optipng-bin
[4/4] โ  node-sass
error /Users/grawl/Sites/jew-simulator/node_modules/node-sass: Command failed.
Exit code: 1
Command: sh
Arguments: -c node scripts/install.js
Directory: /Users/grawl/Sites/jew-simulator/node_modules/node-sass
Output:
module.js:457
    throw err;
    ^

Error: Cannot find module 'stringstream'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/Users/grawl/Sites/jew-simulator/node_modules/request/request.js:15:20)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at SpawnError (/Users/grawl/.yarn/lib/errors.js:18:1)
    at ChildProcess.proc.on.code (/Users/grawl/.yarn/lib/util/child.js:107:15)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:493:12)
info Visit http://yarnpkg.com/en/docs/cli/install for documentation about this command.

If the current behavior is a bug, please provide the steps to reproduce.

  • Have a valid package.json on working project with node-sass (I tried with my Identity build system)
  • Delete node_modules if exists
  • Run yarn from shell
  • Wait

What is the expected behavior?

All packages is installed and gulp build is working.

Please mention your node.js, yarn and operating system version.

$ node -v
v6.6.0
$ yarn -v
yarn install v0.15.1

macOS Sierra Beta 10.12.1 (16B2338c)

Same here with node 4.0.0, same yarn version on macOS 10.11

I have the same error (Cannot find module 'stringstream') but when installing phantomjs.

node v6.2.1
osx 10.11

same

Looks like a duplicate issue from #987

Grawl commented

@carneiror looks like you are right

#987 was closed 9 days ago, but I'm still seeing this issue with node-sass and yarn 0.16.1. Here's the shell log from trying to install it in a new project. May I suggest we re-open? Or am I missing something?

$ yarn init
yarn init v0.16.1
question name (yarn_test):
question version (1.0.0):
question description:
question entry point (index.js):
question git repository:
question author:
question license (MIT):
success Saved package.json
โœจ  Done in 4.33s.

$ yarn add node-sass
yarn add v0.16.1
info No lockfile found.
[1/4] ๐Ÿ”  Resolving packages...
[2/4] ๐Ÿšš  Fetching packages...
[3/4] ๐Ÿ”—  Linking dependencies...
[4/4] ๐Ÿ“ƒ  Building fresh packages...
[1/1] โ ˆ node-sass
[-/1] โ ˆ waiting...
[-/1] โ ˆ waiting...
[-/1] โ ˆ waiting...
error /private/tmp/yarn_test/node_modules/node-sass: Command failed.
Exit code: 1
Command: sh
Arguments: -c node scripts/install.js
Directory: /private/tmp/yarn_test/node_modules/node-sass
Output:
path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.join (path.js:1211:7)
    at /private/tmp/yarn_test/node_modules/node-sass/scripts/install.js:122:26
    at /private/tmp/yarn_test/node_modules/mkdirp/index.js:30:20
    at FSReqWrap.oncomplete (fs.js:111:15)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

same here like @mike-hearn

Haven't look into it carefully, just guess maybe because that script depends on process.env.npm_config_sass_binary_cache and process.env.npm_config_cache?

that error came from path.join(sass.getCachePath(), pkg.name, pkg.version); while

function getCachePath() {
  return process.env.npm_config_sass_binary_cache ||
         process.env.npm_config_cache;
}
Grawl commented

@mike-hearn @whitetrefoil so should I reopen this issue to indicate that the problem still exists?

Have the same issue and what most interesting part is that i didn't change anything in package.json of a project, but "yesterday" everything worked just fine and "today" i have this error:

[4/4] Building fresh packages...
๏ฟฝ[91merror /code/node_modules/node-sass: Command failed.
Exit code: 1
Command: sh
Arguments: -c node scripts/install.js
Directory: /code/node_modules/node-sass
Output:
path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.join (path.js:1213:7)
    at /code/node_modules/node-sass/scripts/install.js:122:26
    at /code/node_modules/mkdirp/index.js:30:20
    at FSReqWrap.oncomplete (fs.js:123:15)

It seems that getCachePath() code was added recently.

I tried to workaround it by adding sass_binary_cache=/home/my_user/.node-sass into ~/.npmrc and it seemed to be successful.

same @mike-hearn
Just before I installed node-sass

yarn add node-sass
node -v
6.2.1

yarn add v0.16.1
[1/4] ๐Ÿ” Resolving packages...
[2/4] ๐Ÿšš Fetching packages...
[3/4] ๐Ÿ”— Linking dependencies...
warning Incorrect peer dependency "css-loader@^0.24.0".
warning Unmet peer dependency "postcss@^5.1.0".
warning Incorrect peer dependency "postcss-loader@^0.11.1".
[4/4] ๐Ÿ“ƒ Building fresh packages...
[-/3] โ ˆ waiting...
[2/3] โ ˆ node-sass
[3/3] โ ˆ node-sass
[-/3] โ ˆ waiting...
error /Users/zhumenghan/eleme-work/eleme/im_fe_cs/node_modules/node-sass: Command failed.
Exit code: 1
Command: sh
Arguments: -c node scripts/install.js
Directory: /Users/zhumenghan/eleme-work/eleme/im_fe_cs/node_modules/node-sass
Output:
path.js:7
throw new TypeError('Path must be a string. Received ' + inspect(path));
^

TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.join (path.js:1213:7)
at /Users/zhumenghan/eleme-work/eleme/im_fe_cs/node_modules/node-sass/scripts/install.js:122:26
at /Users/zhumenghan/eleme-work/eleme/im_fe_cs/node_modules/mkdirp/index.js:30:20
at FSReqWrap.oncomplete (fs.js:117:15)
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

The same problem

Downgrading to yarn@0.16.0 works for me today.

Same problem here. Downgrade helped

@dopesong can you try yarn add --force node-sass using yarn v0.17.8

Can you retest with yarn@latest? Yarn v0.17.10 is installing node-sass successfully with yarn add node-sass.

Still an issue with Yarn v0.19.1 on heroku install

Error: Cannot find module 'code-point-at'
orlin commented

I was getting the same with yarn v0.19.1 and node v6.9.4 on osx. I thought about adding a preinstall npm i node-sass --no-bin-links. However I just upgraded yarn to v0.20.3 and it seems to install fine as well.

Getting this issue on Ubuntu 14.04 w/ node 7.7.3 (and various older 7.x nodes) but only with a locally-installed copy of yarn (i.e., npm install yarn). If I run a globally-installed copy instead, it works correctly.

Trouble is, the machines at work have old (and unchangeable) copies of Node so I have to run a fetch-nvm-and-node script before running yarn, and I don't want the builds to require human interaction to enter a sudo password to globally install yarn.

Here's my own output:

yarn install v0.21.3
[1/4] Resolving packages...
[2/4] Fetching packages...
warning fsevents@1.1.1: The platform "linux" is incompatible with this module.
info "fsevents@1.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/1] โ ‚ node-sass
[-/1] โ ‚ waiting...
[-/1] โ „ waiting...
[-/1] โ „ waiting...
[-/1] โ „ waiting...

------ it stalls here forever, so I Ctrl+C and .... ------

Error: Cannot find module '../errors.js'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at _load_errors (/local/mnt/work/seras/web/node_modules/yarn/lib/cli/index.js:42:20)
    at config.init.then.catch.err (/local/mnt/work/seras/web/node_modules/yarn/lib/cli/index.js:456:34)

I'm able to get around this by having npm rebuild node-sass in my postinstall script in package.json.

I'm having issues with this where a dependency has a postinstall script that requires node-sass. Adding "postinstall": "npm rebuild node-sass" in my package doesn't solve this for me. This is with Yarn v0.24.5

@AlejandroHuerta, can you share the steps to reproduce your issue?

I've got another insight on this one:
If the node-sass package is not installed and one runs "npm update" this error triggers.
Tested with Node v8.1.2 and NPM v5.0.3.

@bestander here is a simple repro:

git clone https://github.com/barbar/vortigern.git
yarn install

then npm rebuild node-sass will fail. This problem does not happen when installing the packages with npm.

BYK commented

This seems to be fixed with Yarn 1.0+. Can someone confirm? @bherila I wasn't able to reproduce the issue with the steps you provided on latest master. If Yarn 1.0.2 still doesn't work for you, would you mind trying one of the nightlies from https://yarnpkg.com/en/docs/nightly

Yarn 1.0.2 didn't work for me, but the current nightly build (1.0.2-20170922.1215) solved this issue for me.

npm install node-sass --sass-binary-site=https://npm.taobao.org/mirrors/node-sass/