-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
[BUG] npx commands failing due to parsing bug #2410
Comments
Why would you need an npx prefix to run node? |
We were using it so that in a script, we could change the PATH environment variable to include the project's node_modules, and run commands from packages inside, e.g.:
My understanding is npx modifies the context a process runs in by automatically determining the right paths to add. If you omit the npx prefix, and ran We were using For the tool I am building, we don't want consumers to have to manually prefix commands with "npx" depending on whether it's an npm script or a python script etc. so that's why we are trying to set up the environment like this. (This stackoverflow post is also in the same spirit of what I'm describing / the challenges - https://stackoverflow.com/questions/39990788/achieve-npm-run-x-behavior-without-a-scripts-entry) |
I tried this on 7.4.0 and the example I gave works now. 👍 |
Fixed by #2448. |
Current Behavior:
Expected Behavior:
Steps To Reproduce:
See commands above.
I've tried running this with several npm version combinations, and it appears to be a regression introduced in npm 7.1.0. That is, with the npm@7.0.15 the command succeeds (prints 3), but starting in npm@7.1.0 it fails. This was brought to my attention when I was updating to the latest node release (v15.5.0) two days ago via nvm, which updates npm to 7.3.0 (changelog).
Environment:
The text was updated successfully, but these errors were encountered: