-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
preferLocal prevents local from working #196
Comments
Thanks for reporting this. Could you please describe in few words what |
It just downloads a Yarn version from Github, stores it within a directory local to the project (which one exactly is unspecified), and updates the When you run |
This is a little complex, so I'm going to try to paraphrase it to make sure I understood. The original problem How it is solved: a configuration/setting can be set in the local directory to indicate the preferred How the spawning occurs: what I might understand is that:
Things I am not sure:
Could you correct and complete my current understanding? Thanks for helping me out understand this :) |
No problem! 🙂
If the global Yarn detects a local
Initially the global one, which then defers to the local one via the mechanism described above. The local one then enters into the
Only added at the time of
The script is dynamically generated based on the value of #!/usr/bin/env bash
exec "/path/to/node" "/path/to/my/local/yarn-1.5.2.js" "$@" |
Alright so if I understood correctly, this is what happens:
First, please let me know if I now got it right. I still have some questions:
|
It's in an unspecified directory. The
Typically when you use
Two reasons:
Yep. Basically Yarn does the same thing as |
Ok please excuse me there, but I am going to rewrite the problem again. It's not just for me but also for @sindresorhus so he can get a quick grasp of the problem as well. This is what happens:
Your problem: Some follow-up questions:
|
Thanks for bearing with me, appreciated 👍
I'd reword that by adding an extra step:
It's in the
I think it would in my case, yep. It looks fragile though ... for example if the PATH contains
Hm I think you've reversed local and global here, since the end goal is to call the local Yarn, not the global Yarn? Assuming it was intended to be the other way around (why doesn't the global Yarn call the local Yarn anyway within This isn't the case when using Plug'n'Play, since the third-party packages are located within the cache (and thus the global Yarn wouldn't detect that it needs to forward to the local one). |
Oh alright, so the problem is that the shell script is meant to have highest priority, but About the PR sindresorhus/npm-run-path#5: good point that this does not work when
For further discussion on that PR though, this might be better to do it on the PR itself. What's important is whether this PR might solve your issue. About my last comment ("I think you've reversed local and global here") forget it, I just got it wrong :) This seems like the PR sindresorhus/npm-run-path#5 might solve your problem. To recap what this PR is doing:
This PR needs to be reviewed and merged by @sindresorhus. If this PR might solve your issue, feel free to comment on potential issues with its implementation. |
I think I've finally managed to wrap my head around this issue. I've updated the PR description sindresorhus/npm-run-path#5 accordingly. The next step for this to move forward would be the get some input from @sindresorhus. |
Ping? |
@sindresorhus I think the three following issues are connected: #196, #153 and sindresorhus/npm-run-path#5 (which seems unlikely to be merged). Those issues are among the last things left on the v2 milestone. What could we do to solve the issues experienced by users on this? |
Ping bis? 😊 |
@sindresorhus I thought of a way to move forward with this: see sindresorhus/npm-run-path#5 (comment) Please let me know what you think. That's one of the last items for v2 release. |
Phew. I got it too. The whole problem is Btw, @ehmicky, check your the #!/bin/sh
# that's the path to `execPath`
exec "/home/charlike/.nvm/versions/node/v12.4.0/bin/node" "$@" the #!/bin/sh
exec "/home/charlike/.nvm/versions/node/v12.4.0/bin/node" "/home/charlike/.nvm/versions/node/v12.4.0/bin/yarn" "$@" So in case you use Sorry for the screenshotting, but I'm lazy now to record https://asciinema.org terminal video. 😆 |
@arcanis If I understood your problem correctly, using the We are considering changing its default value from This would limit this problem to users who want to use |
I'm closing this since #314 got merged. |
@ehmicky We still need to fix this, even if it's not the default behavior. |
#191 (comment)
Example:
package.json
example.js
command line
In this case, you see that Yarn rightfully enforced the use of the 1.15.2 release when calling
foo
. Unfortunately, since execa overrides the PATH withdirname(node)
, it also overrode in the process the Yarn binary that we set in the path, which causes the wrong one to be used.It's even more of a problem with Plug'n'Play, since we inject the path to the binaries within the PATH (rather than always injecting the same
node_modules/.bin
folder). A similar problem then occurs where if you previously rannpm install -g babel-cli
, then your execa scripts will use it instead of the local one.The text was updated successfully, but these errors were encountered: