[BUG] Dependency alias breaks local `npm install`
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
I have two local packages, foo and bar, packed into separate .tgz files. bar depends on foo.
- I install
foo - I install
bar - ✅ Success. npm just uses the already-installed
foo.
Now I update bar to depend on foo with a package alias:
- I install
foo - I install
bar - ❌ Error loading
barfrom npmjs.org. (It is not, and will not be, there)
Expected Behavior
I would expect both of the above scenarios to result in a successful package install.
Steps To Reproduce
Bug reproduction and instructions here:
https://github.com/NfNitLoop/bug-npm-alias-breaks-local-install
Environment
- npm: 11.3.0
- Node.js: v23.7.0
- OS Name: Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:22 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6041 arm64
- System Model Name: Macbook pro
- npm config:
; "builtin" config from /opt/homebrew/lib/node_modules/npm/npmrc
prefix = "/opt/homebrew"
; node bin location = /opt/homebrew/Cellar/node/23.7.0/bin/node
; node version = v23.7.0
; npm local prefix = /Users/codycasterline/code/bug-npm-alias-breaks-local-install
; npm version = 11.3.0
; cwd = /Users/codycasterline/code/bug-npm-alias-breaks-local-install
; HOME = /Users/codycasterline
; Run `npm config ls -l` to show all defaults.
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 with the linked reproduction repository and run its instructions using the two local .tgz packages. Compare installation with the direct dependency and the package alias; done means both local installation scenarios succeed without trying to load bar's dependency from npmjs.org.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100