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

Updating a package that depends on yarn globally will override system yarn #7132

Open
ahmedelgabri opened this issue Mar 20, 2019 · 1 comment

Comments

@ahmedelgabri
Copy link
Contributor

ahmedelgabri commented Mar 20, 2019

This is not an issue with yarn itself, but a current issue faced oclif/plugin-plugins#71 which is a dependency of netlify/cli#269

When yarn installs global packages they usually symlink global node_modules/.bin to /usr/local/bin so if you install a global package that depends on yarn, yarn will override the system installed yarn with the node_module/.bin/yarn one.

I can see this issue starting to get bigger after yarn v2 is released too.

This might be related to #2627, #3157

So is there is any workaround? Also how can this be prevented?

Not 100% sure but npm might also have this if npm is a dependency of a package too

Thanks to @bk3c, he managed to reproduce the issue (see oclif/plugin-plugins#71 (comment)) & I also confirm that this is the case for me too.

FWIW, I've been struggling with the effects of this for a few months, and finally figured it out enough to find this issue. I'm pretty sure I have a reproducible case, though I can't tell if this is actually yarn being broken or misused:

  • my system yarn is via homebrew
  • I have two globally installed packages that depend on this one (apollo and netlify-cli), and this is the only global dependency I have on yarn
  • if I wipe my global yarn.lock and node_modules and reset all of the symlinks, I can do a yarn add to recreate both with no problems at all
  • as soon as I do a yarn global upgrade or yarn global upgrade-interactive, the symlinks in /usr/local/bin are overwritten and now point to ~/.config/yarn/global/node_modules/.bin/yarn
  • this is 100% reproducible, at least in my environment
  • it's super-annoying
@ahmedelgabri
Copy link
Contributor Author

ahmedelgabri commented Mar 20, 2019

After further investigation, it seems to be something related to my setup. Can't figure out what it is yet

@ahmedelgabri ahmedelgabri changed the title Installing a package that depends on yarn globally will override system yarn Updating a package that depends on yarn globally will override system yarn Aug 16, 2019
@ahmedelgabri ahmedelgabri reopened this Aug 16, 2019
@ahmedelgabri
Copy link
Contributor Author

See the updated description /cc @bk3c

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

No branches or pull requests

1 participant