-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: $npm_execpath
always points to npm, even when running npx
#6762
Conversation
$npm_execpath
$npm_execpath
always points to npm, even when running npx
re-add flatOptions.npmBin hoist nodeBin to config option and respect execPath override
$npm_execpath
always points to npm, even when running npx$npm_execpath
always points to npm, even when running npx
Not sure why CI is having the specific errors it is, but when I run config tests locally they don't pass, and there are coverage issues. Does |
I'm surprised it's trying to run against node <18. This commit definitely broke the runs on node 14: b8a5764 No, the CI is not currently passing for me locally.
I had to adjust some tests to account for moving logic out of the flatten helper. I'll figure out the coverage issue once I verify the tests run as expected. |
The last commit (b8b1db3) I'm slightly unsure about. This commit started writing to the variable: c3ba1da EDIT: it also seems like inheriting this value is probably unexpected, given npm/config#12 for the closely related Your thoughts are much appreciated. |
BTW, as of now, test cases all pass for me and coverage is at 100%. |
I agree that the Historically we have been removing the ability to change things like this, for instance in npm 10 re removed the However, removing this could be a breaking change to folks. We're gonna have to leave it in. However I also think we shouldn't worry about covering that in testing. Can you add I'll add a note to the npm 11 roadmap to remove it for real. |
I thought about that and it makes me feel icky. The ignored path is the one MOST COMMON in practice. This PR is already a breaking change, and insofar as the NODE environment variable does anything, it’s a bug as well. If you still insist, I can move it to another PR. |
Ok lemme noodle on it. Ultimately the NODE environment is in all likelihood trying to solve the problem of having everything in side the npm lifecycle use the same node version as the one that npm was ran with. I do remember this being an issue in the past, we don't want to support running different versions of node or npm in subprocesses. In the past this manifested as refusing to support a config that told npm what version of node to run, that's an OS concern. I think removing it may be the right choice here but as you can imagine we are trying to be extremely cautious with things that could break other folks. |
@wraithgar, what did your noodle say? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can re-export NODE if an edge case we didn't know about comes to light.
Woohoo!
I didn’t stop exporting |
Ok yeah that's what I get from typing from memory. |
When running a script with
npx
(but not withnpm exec
),$npm_execpath
is set to ".../npm/bin/npx-cli.js". This causes packages to fail to detect the package manager.Now
$npm_execpath
will always be the path tonpm-cli.js
.References
Fixes #6662