Skip to content

Yarn mislinks devDependencies when NODE_ENV=production #2104

Description

@STRML

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions