[BUG] npx is ignoring NODE_PATH
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
Description
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
If I run, NODE_PATH=/path/to/my/node_modules npm, I'm able to load all of my locally installed packages, but if i do the same with npx, it does not see any of them and only works with node_modules in the current working directory.
Expected Behavior
If I run, NODE_PATH=/path/to/my/node_modules npm, I'm able to load all of my locally installed packages, but if i do the same with npx, it does not see any of them and only works with node_modules in the current working directory.
Steps To Reproduce
If I run, NODE_PATH=/path/to/my/node_modules npm, I'm able to load all of my locally installed packages, but if i do the same with npx, it does not see any of them and only works with node_modules in the current working directory.
Environment
- npm: 9.6.7
- Node.js: 9.6.7
- OS Name: NixOS
- System Model Name: NixOS
- npm config:
; copy and paste output from `npm config ls` here
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported difference between npm and npx with NODE_PATH=/path/to/my/node_modules on NixOS, using the npx entry point. Compare how each command resolves packages and add or update coverage for NODE_PATH behavior; done means npx can load packages from the configured NODE_PATH as npm does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100