Yarn: Install step is run on optional package not supported by OS

Created on 19 Oct 2016  ·  14Comments  ·  Source: yarnpkg/yarn

Do you want to request a _feature_ or report a _bug_?
Bug

What is the current behavior?
chokidar has an optional dependency on fsevents which is unsupported on windows. It seems to attempt to run an install step on it anyway.

yarn install v0.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/1] ⢀ fsevents: Windows_NT 10.0.14393
[-/1] ⢀ waiting...
[-/1] ⢀ waiting...
[-/1] ⢀ waiting...
error Error running install script for optional dependency: "C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents: Command failed.\nExit code: 1\nCommand: C:\\WINDOWS\\system32\\cmd.exe\nArguments: /d /s /c node-pre-gyp install --fallback-to-build\nDirectory: C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents\nOutput:\nnode-pre-gyp info it worked if it ends with ok\nnode-pre-gyp info using [email protected]\nnode-pre-gyp info using [email protected] | win32 | x64\nnode-pre-gyp info check checked for \"C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents\\lib\\binding\\Release\\node-v48-win32-x64\\fse.node\" (not found)\nnode-pre-gyp http GET https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v48-win32-x64.tar.gz\nnode-pre-gyp http 404 https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v48-win32-x64.tar.gz\nnode-pre-gyp ERR! Tried to download: https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v48-win32-x64.tar.gz \nnode-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp) \nnode-pre-gyp http Pre-built binary not available for your system, looked for https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.0.14/fse-v1.0.14-node-v48-win32-x64.tar.gz \n\r\nC:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents>if not defined npm_config_node_gyp (node \"C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\yarn\\bin\\node-gyp-bin\\\\..\\..\\node_modules\\node-gyp\\bin\\node-gyp.js\" clean )  else (node  clean ) \r\ngyp info it worked if it ends with ok\ngyp info using [email protected]\ngyp info using [email protected] | win32 | x64\ngyp info ok \n\r\nC:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents>if not defined npm_config_node_gyp (node \"C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\yarn\\bin\\node-gyp-bin\\\\..\\..\\node_modules\\node-gyp\\bin\\node-gyp.js\" configure --fallback-to-build --module=C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents\\lib\\binding\\Release\\node-v48-win32-x64\\fse.node --module_name=fse --module_path=C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents\\lib\\binding\\Release\\node-v48-win32-x64 )  else (node  configure --fallback-to-build --module=C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents\\lib\\binding\\Release\\node-v48-win32-x64\\fse.node --module_name=fse --module_path=C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents\\lib\\binding\\Release\\node-v48-win32-x64 ) \r\ngyp info it worked if it ends with ok\ngyp info using [email protected]\ngyp info using [email protected] | win32 | x64\ngyp ERR! configure error \ngyp ERR! stack Error: Can't find Python executable \"python\", you can set the PYTHON env variable.\ngyp ERR! stack     at failNoPython (C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\yarn\\node_modules\\node-gyp\\lib\\configure.js:449:14)\ngyp ERR! stack     at C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\yarn\\node_modules\\node-gyp\\lib\\configure.js:404:11\ngyp ERR! stack     at C:\\Program Files (x86)\\Nodist\\bin\\node_modules\\yarn\\node_modules\\graceful-fs\\polyfills.js:264:29\ngyp ERR! stack     at FSReqWrap.oncomplete (fs.js:123:15)\ngyp ERR! System Windows_NT 10.0.14393\ngyp ERR! command \"C:\\\\Program Files (x86)\\\\Nodist\\\\v-x64\\\\6.3.0\\\\node.exe\" \"C:\\\\Program Files (x86)\\\\Nodist\\\\bin\\\\node_modules\\\\yarn\\\\node_modules\\\\node-gyp\\\\bin\\\\node-gyp.js\" \"configure\" \"--fallback-to-build\" \"--module=C:\\\\Source\\\\Roadmap\\\\master\\\\Nis.WebAgent\\\\frontend\\\\node_modules\\\\fsevents\\\\lib\\\\binding\\\\Release\\\\node-v48-win32-x64\\\\fse.node\" \"--module_name=fse\" \"--module_path=C:\\\\Source\\\\Roadmap\\\\master\\\\Nis.WebAgent\\\\frontend\\\\node_modules\\\\fsevents\\\\lib\\\\binding\\\\Release\\\\node-v48-win32-x64\"\ngyp ERR! cwd C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents\ngyp ERR! node -v v6.3.0\ngyp ERR! node-gyp -v v3.4.0\ngyp ERR! not ok \nnode-pre-gyp ERR! build error \nnode-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents\\lib\\binding\\Release\\node-v48-win32-x64\\fse.node --module_name=fse --module_path=C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents\\lib\\binding\\Release\\node-v48-win32-x64' (1)\nnode-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\\Source\\Roadmap\\master\\Nis.WebAgent\\frontend\\node_modules\\fsevents\\node_modules\\node-pre-gyp\\lib\\util\\compile.js:83:29)\nnode-pre-gyp ERR! stack     at emitTwo (events.js:106:13)\nnode-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)\nnode-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:852:16)\nnode-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)\nnode-pre-gyp ERR! System Windows_NT 10.0.14393\nnode-pre-gyp ERR! command \"C:\\\\Program Files (x86)\\\\Nodist\\\\v-x64\\\\6.3.0\\\\node.exe\" \"C:\\\\Source\\\\Roadmap\\\\master\\\\Nis.WebAgent\\\\frontend\\\\node_modules\\\\fsevents\\\\node_modules\\\\node-pre-gyp\\\\bin\\\\node-pre-gyp\" \"install\" \"--fallback-to-build\"\nnode-pre-gyp ERR! cwd C:\\Source\\Roadmap\\master\\Nsuccess Saved lockfile.
Done in 23.41s.

If the current behavior is a bug, please provide the steps to reproduce.
Depend on chokidar or something like webpack on windows.

What is the expected behavior?
The optional package should pretty much be completely skipped when unsupported by the OS.

Please mention your node.js, yarn and operating system version.
Node 6.8.1, yarn 0.16.0, windows 10

Most helpful comment

Worth mentioning also that it reattempts the install every time I try to install a package, irrespective of whether that package has any dependency on fsevents. This is "just noise", sure, but it also slows the install right down, seeing as fsevents is not exactly the most lightweight of packages.

All 14 comments

I have the same issue

I'm also experiencing this.

As a short-term solution I discovered you can do yarn install --ignore-optional.

It still prints this error:

warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.

Which I think it shouldn't, but it does skip the actual installation.

I don't think it's entirely a duplicate of #705 but probably related.
An optional and incompatible package should not be attempted to be installed, and you should not have to explicitly tell it to skip it with --ignore-optional

Also, the installation seems to complete. So it's just noise. Still unintended though.

@mvestergaard Yes, if you read the comments below the issue I have opened you will see we are talking about the same thing :) Yarn tries to install optional deps which are not for that OS which is the actual bug.

@Sh1d0w Yep, you're right. I'll close this in favor of #705

I face same issue. It should only print warning fsevents .... like npm.

In my opinion, it should not dump whole error to output. It's too long. And it ruin response output.
Error should be written into log file.

Worth mentioning also that it reattempts the install every time I try to install a package, irrespective of whether that package has any dependency on fsevents. This is "just noise", sure, but it also slows the install right down, seeing as fsevents is not exactly the most lightweight of packages.

Happening to me when I install any package too:

yarn add react-dom                                                  [~]✭
yarn add v1.2.1
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "[email protected]" has unmet peer dependency "babel-core@6".
[4/4] 📃  Building fresh packages...
[1/1] ⢀ weak
[-/1] ⢀ waiting...
[-/1] ⢀ waiting...
[-/1] ⢀ waiting...
warning Error running install script for optional dependency: "/Users/jamesjeffery/Desktop/react-midi/node_modules/weak: Command failed.\nExit code: 1\nCommand: node-gyp rebuild\nArguments: \nDirectory: /Users/jamesjeffery/Desktop/react-midi/node_modules/weak\nOutput:\nmodule.js:529\n    throw err;\n    ^\n\nError: Cannot find module 'abbrev'\n    at Function.Module._resolveFilename (module.js:527:15)\n    at Function.Module._load (module.js:476:23)\n    at Module.require (module.js:568:17)\n    at require (internal/module.js:11:18)\n    at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/node_modules/nopsuccess Saved lockfile.success Saved 1 new dependency.└─ [email protected]
✨  Done in 4.84s.

fwiw I still see this on macOS, latest version

For me this was corrected by running
sudo xcodebuild -license - i had updated my mac os and not yet agreed to the new license ^.^

Sorry did not fix it for me

@pdeka I would ensure that you have the proper default node version is configured to ensure that your child processes aren't running on a different version of node. Not sure if this context helps, but worth a shot. Check default node version with nvm alias default to check, and nvm alias default <version> to change to desired default version. Mine is set to 10.16.0, for example. All the best.

Was this page helpful?
0 / 5 - 0 ratings