Skip to content

[BUG] Please respect the calling runtime and PATH. #4164

@Dmole

Description

@Dmole

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Currently npm can not be used if there is more than one node version installed,
because npm will ignore the calling node runtime,
and npm will ignore the node runtime on the PATH,
and npm will refuse to run from node directly,
instead npm will use an arbitrary runtime.

Expected Behavior

npm should use the current runtime, and respect $PATH.

Steps To Reproduce

sudo which -a node
/usr/local/bin/node
/usr/bin/node
/bin/node
sudo which node
/usr/local/bin/node
sudo /usr/local/bin/node --version
v17.1.0
sudo /usr/local/bin/node /usr/local/bin/npm install -g node@latest
...
npm ERR! npm WARN npm npm does not support Node.js v10.19.0
...
node
Welcome to Node.js v17.1.0.
Type ".help" for more information.
> npm install -g node@latest
npm should be run outside of the Node.js REPL, in your normal shell.
(Press Ctrl+D to exit.)
>

Environment

  • npm:8.1.4
  • Node:v17.1.0
  • OS:Ubuntu 20.04.3 LTS
  • platform:Dell XPS 13 9310
  • npm config:
; node bin location = /home/user/node_modules/node/bin/node
; cwd = /home/user/Documents/eclipse-workspace/Noodle
; HOME = /home/user

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 8.xwork is associated with a specific npm 8 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions