Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn add --ignore-optional fails when optional dep has failing postinstall #2929

Closed
anp opened this issue Mar 16, 2017 · 3 comments
Closed
Labels

Comments

@anp
Copy link

anp commented Mar 16, 2017

Reproduction

On a freshly init'd project:

$ yarn add --ignore-optional optional-failure

The optional-failure package has an optional dependency on pkg-with-failing-postinstall.

Here's the full output from running this command on my machine:

$ yarn add --ignore-optional optional-failure
yarn add v0.22.0-1-exp
info No lockfile found.
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
⠁
error /Users/adam/code/lololololol/node_modules/pkg-with-failing-postinstall: Command failed.
Exit code: 1
Command: sh
Arguments: -c node this-does-not-exist.js
Directory: /Users/adam/code/lololololol/node_modules/pkg-with-failing-postinstall
Output:
module.js:472
    throw err;
    ^

Error: Cannot find module '/Users/adam/code/lololololol/node_modules/pkg-with-failing-postinstall/this-does-not-exist.js'
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:425:7)
    at startup (bootstrap_node.js:146:9)
    at bootstrap_node.js:540:3
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

This produces an exit status of 1.

Expected Behavior

The --ignore-optional flag should allow optional postinstall scripts to fail and be handled the same way failing installs of optional deps are handled.

System information

I've reproduced this on two systems:

  1. Node 6.9.1, yarn 0.21.3, Windows 10
  2. Node 7.7.1, yarn 0.22.0-1 (with a couple of patches from master), Mac Sierra 10.12.3
@skevy
Copy link
Contributor

skevy commented Mar 16, 2017

cc @bestander @Daniel15 -- just wanted to flag this to ya'all because it's breaking create-react-native-app for a bunch of users (anyone who doesn't have node native tools installed).

@bestander
Copy link
Member

Thanks, totally worth sending a PR and fixing it sooner.
Feel free to ping me there.

@bestander
Copy link
Member

Fixed in 0.27

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants