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

fix(run): change run command to prioritize cwd/node_modules/.bin #7750

Closed
wants to merge 3 commits into from

Conversation

priceld
Copy link

@priceld priceld commented Dec 10, 2019

Summary
This change builds off of #7151 and fixes #7748.

The issue is that when a binary is hoisted and also installed in a workspace package, yarn bin and yarn run (from the workspace package) fail to use the correct binary (they use the hoisted binary instead of the locally installed binary).

This PR just changes the order in which the array of paths is built so that the CWD bin path has a higher precedence than the hoisted bin path.

Test plan
Added two new tests that verify the correct binary is executed when running yarn run. One test has the same binary installed in a workspace package and hoisted to the root. The other test just has a binary hoisted to the root. Both tests try to run their binaries from a workspace package and verify that the right binary was used.

@priceld priceld changed the title Fix bin path precedence 7748 fix(run): change run command to prioritize cwd/node_modules/.bin Dec 10, 2019
@priceld
Copy link
Author

priceld commented Dec 10, 2019

@rally25rs @arcanis @BYK - just wanted to loop in some of the others that were on #7151

@jasonmobley
Copy link

@BYK any chance you could provide review? It's a follow-up to #7151 which you reviewed. Thanks!

@jdmarshall
Copy link

What's needed to get this PR landed?

@jasonmobley
Copy link

@jdmarshall it needs conflicts resolved, but it has sat for months waiting for someone to review. Seems the maintainers have abandoned Yarn 1.x in favor of Berry.

@priceld
Copy link
Author

priceld commented Jun 9, 2023

Yarn 1 is no longer maintained. Closing.

@priceld priceld closed this Jun 9, 2023
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 this pull request may close these issues.

yarn bin <executable> returns the wrong path when executable is hoisted and installed in workspace
3 participants