-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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] --scripts-prepend-node-path doesn't populate PATH #2808
Comments
I’m confused, how would npm run if node wasn’t in the PATH already? |
As commented by calling |
ok - why would you do that tho, if you already have the full path? |
I'm not actively doing that. It's the way IDEs like WebStorm call scripts with a node and npm version that you can select in the preferences or on a per-project basis. For reference, see this issue (and feel free to comment there, too). |
Running npm or node without |
Well, I agree that it's probably not the intended way to run it and also that npm is not responsible for any failing sub script, but the docs clearly define how
And as far as I can see it, that's not working in my (maybe exotic, but still valid) case. (edit: of course that's assuming that Another edit:
I believe the JetBrains employee was referencing this line from the |
right - that’s not something anything else should be doing. npm is part of the platform, webstorm is not. |
Okay, let's put WebStorm aside for a moment and look at the simple question: "Is calling If not and if you could point me to some sort of documentation about this, I'd gladly pass that information on to JetBrains and ask them to change how they call |
I just noticed npm/statusboard#117. If I interpret that correctly, the flag in question isn't even in the code anymore (which would explain why I wasn't able to find it after all). Can you confirm that? |
@Gerrit-K apologize for the confusion here; |
@darcyclarke thanks, that clarification helps a lot. I'll point JetBrains to this issue and let them know that they need to adjust their calling code. |
Quite odd, an RFC is required to put the flag back but there is no RFC or even a mention on a commit message anywhere in that repository about removing it. It was just gone breaking every development environment that uses more than one node version. It is also not mentioned in any changelog here since 2016 when it was added. The problem here is clearly not about docs, that option should not have been removed |
Current Behavior:
The flag
--scripts-prepend-node-path
, which is supposed to add the callingnode
executable to thePATH
variable, doesn't seem to work. The directory isn't added.Expected Behavior:
The directory of the calling
node
executable should be added toPATH
.Steps To Reproduce:
14.15.5
and7.6.0
respectively)package.json
(in my casenpm init nx-workspace
)node
andnpm
in isolation to any shell environment:env -i bash --noprofile --norc -c '/path/to/.nvm/versions/node/v14.15.5/bin/node /path/to/.nvm/versions/node/v14.15.5/lib/node_modules/npm/bin/npm-cli.js --scripts-prepend-node-path run nx'
sh: nx: command not found
I've prepended the node call withPATH=$PATH:/path/to/.nvm/versions/node/v14.15.5/lib/node_modules/nx/bin
)Expected Behavior:
The help message of
nx
Current Behavior:
env: node: No such file or directory
If you add a script with
env
orecho $PATH
to thepackage.json
you can see thatPATH
doesn't contain the directory to the callingnode
executable, so I assume it's not a bug ofnx
.Environment:
The text was updated successfully, but these errors were encountered: