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 mislinks devDependencies when NODE_ENV=production #2104

Closed
STRML opened this issue Dec 1, 2016 · 3 comments
Closed

Yarn mislinks devDependencies when NODE_ENV=production #2104

STRML opened this issue Dec 1, 2016 · 3 comments
Labels

Comments

@STRML
Copy link
Contributor

STRML commented Dec 1, 2016

Tested this with v0.17.9 and with v0.17.10, Node 6.9.1.

The following package.json:

{
  "devDependencies": {
    "mocha": "^3.2.0"
  },
  "dependencies": {
    "markdown-it": "^8.2.0"
  }
}

Produces this .bin directory when running yarn:

$ yarn
yarn install v0.17.9
warning No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
✨  Done in 0.51s.
~/g/f/yarn-link (master|…) $ ll node_modules/.bin
total 24
lrwxr-xr-x  1 samuelreed  staff    19B Dec  1 11:09 _mocha -> ../mocha/bin/_mocha
lrwxr-xr-x  1 samuelreed  staff    33B Dec  1 11:09 markdown-it -> ../markdown-it/bin/markdown-it.js
lrwxr-xr-x  1 samuelreed  staff    18B Dec  1 11:09 mocha -> ../mocha/bin/mocha

But this incorrect .bin when running env NODE_ENV=production yarn:

$ env NODE_ENV=production yarn
yarn install v0.17.9
warning No license field
[1/4] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.10s.
~/g/f/yarn-link (master|…) $ ll node_modules/.bin
total 24
lrwxr-xr-x  1 samuelreed  staff   102B Dec  1 11:10 _mocha -> ../../../../../Library/Caches/Yarn/npm-mocha-3.2.0-7dc4f45e5088075171a68896814e6ae9eb7a85e3/bin/_mocha
lrwxr-xr-x  1 samuelreed  staff    33B Dec  1 11:10 markdown-it -> ../markdown-it/bin/markdown-it.js
lrwxr-xr-x  1 samuelreed  staff   101B Dec  1 11:10 mocha -> ../../../../../Library/Caches/Yarn/npm-mocha-3.2.0-7dc4f45e5088075171a68896814e6ae9eb7a85e3/bin/mocha

This can cause these bins to fail, for example with nsp, which fails resolving its dependency, subcommand.

Same results on v0.17.10, OSX 10.11, and on Ubuntu 14.04. I can confirm this is a regression from v0.16.1.

Might be related to #1379, #761.

@sebmck
Copy link
Contributor

sebmck commented Dec 2, 2016

Fixed via #2116.

@sebmck sebmck closed this as completed Dec 2, 2016
@joeyespo
Copy link
Contributor

joeyespo commented Jan 4, 2017

I'm seeing this happen again on Heroku when NODE_ENV=production and NPM_CONFIG_PRODUCTION=false. (See heroku/heroku-buildpack-nodejs#337)

@kittens It's not clear how #2116 fixes the problem. Happen to know off the top of your head where in that PR the fix is for this specific issue? (I'd be happy to PR a new fix for this regression, but digging through that large commit isn't giving any clarity as to how it was fixed the first time.)

@STRML
Copy link
Contributor Author

STRML commented Jun 25, 2018

This is still broken with the same reproduction as in the original ticket.

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