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 Workspaces - binaries are linked incorrectly #4359

Closed
ohana54 opened this issue Sep 8, 2017 · 6 comments · Fixed by #4730
Closed

Yarn Workspaces - binaries are linked incorrectly #4359

ohana54 opened this issue Sep 8, 2017 · 6 comments · Fixed by #4730

Comments

@ohana54
Copy link

ohana54 commented Sep 8, 2017

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

What is the current behavior?

When using Yarn Workspaces, binaries are linked incorrectly when running yarn install in a specific package.

Setup:

  1. package-a depends on webpack@3
  2. package-b depends on webpack@1
  3. package-c depends on webpack@1
  4. Yarn Workspaces enabled

Steps:
run yarn install inside package-b

A repo demonstrating the issue is here: https://github.com/ohana54/yarn-bug

Result:
package-b/node_modules/.bin/webpack is linked to package-a/node_modules/webpack/bin/webpack.js

What is the expected behavior?
package-b/node_modules/.bin/webpack is linked to [root-folder]/node_modules/webpack/bin/webpack.js

Please mention your node.js, yarn and operating system version.
node v.6.11.0, yarn v1.0.1, Mac OSX 10.11.4

Note: this can also happen when the current state is correct, and then running yarn add some-package inside package-b.

EDIT: simpler steps to reproduce
EDIT 2: copied the steps from the repo, added another way to reproduce

@ohana54 ohana54 changed the title Yarn Workspaces - binaries might be linked incorrectly Yarn Workspaces - binaries are linked incorrectly Sep 8, 2017
@ohana54
Copy link
Author

ohana54 commented Sep 29, 2017

Ca anyone help with this? It prevents us switching to workspaces.
I tried to debug it but kinda got lost in the code, would appreciate any help.
Thanks!

@edmorley
Copy link
Contributor

I can still reproduce this after the various workspaces fixes in yarn 1.2.0.

@edmorley
Copy link
Contributor

edmorley commented Oct 19, 2017

To clarify the STR slightly, it looks like the bug only occurs if yarn install was not run in the repo root prior to the package-b yarn install.

ie:

  1. git clone https://github.com/ohana54/yarn-bug
  2. cd yarn-bug/package-b/
  3. yarn install
  4. Inspect yarn-bug/package-b/node_modules/.bin/webpack

Expected:
Symlink to (or on Windows, a wrapper pointing at) [root-folder]/node_modules/webpack/bin/webpack.js

Actual:
Symlink to (or on Windows, a wrapper pointing at) package-a/node_modules/webpack/bin/webpack.js

jgoz added a commit to jgoz/yarn that referenced this issue Oct 19, 2017
@BYK BYK closed this as completed in #4730 Oct 19, 2017
BYK pushed a commit that referenced this issue Oct 19, 2017
**Summary**

Fixes #4706, fixes #4359, refs #4513. `this.config.cwd` was being used as the root for bin link paths, rather than `this.config.lockfileFolder`.

**Test plan**

- Added tests for `add` and `remove` commands (#4706)
- Added test for `install` command (#4359)
@ohana54
Copy link
Author

ohana54 commented Oct 20, 2017

Thanks everyone for handling this, I really appreciate it. Can't wait to upgrade the version and try again!

joaolucasl pushed a commit to joaolucasl/yarn that referenced this issue Oct 27, 2017
**Summary**

Fixes yarnpkg#4706, fixes yarnpkg#4359, refs yarnpkg#4513. `this.config.cwd` was being used as the root for bin link paths, rather than `this.config.lockfileFolder`.

**Test plan**

- Added tests for `add` and `remove` commands (yarnpkg#4706)
- Added test for `install` command (yarnpkg#4359)
@jonaskello
Copy link

I just hit the same problem. Is this released yet?

@jdmarshall
Copy link

I have encountered a similar problem, but was able to reproduce it while running a regularyarn install on a clean directory (no node_modules anywhere). I don't think this is particular to installing a new module.

#5827

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

Successfully merging a pull request may close this issue.

4 participants