-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[BUG] Dependency alias breaks local npm install
#8223
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
Comments
npm install
During my initial bug search, I found a similar issue: #6108 But in this case I'm not using any registry, I'm just trying to install packages I have on-disk. |
Based on your code it looks like you are mixing npm alias format is different https://docs.npmjs.com/cli/v11/using-npm/package-spec#aliases |
Sorry for the confusion. I discovered this bug while testing a different bug with pnpm, so re-using that example was the quickest way for me to get to a reproduction. I think There are instructions and pre-built .tgz files in that repo for reproducing with Let me go grab the generated |
Ah yeah, I'd already included it in the README over there: "dependencies": {
"@my_private_scope_example/myFooAlias": "npm:@my_private_scope_example/foo@1.0.0"
}, This appears to be valid npm syntax. For example, I can create a new package.json with: "dependencies": {
"@myFakeScope/example": "npm:@preact/signals@^2.0.3"
} And Update: Additionally, I think the docs for the npm aliasing format on that page are incorrect. If I understand the intent correctly, the format is However, the doc example
There's an extra
|
when using alias, as far as i know it will look for that package in configured registry. as long as your package is there in registry it should pick it up. I feel that you are using the package from your workspace as a local linked dependency through alias then packing it and installing again so while installing it tries to find that package in registry. |
Sorry, just saw your last response:
IMO, that's the core of this bug. Without using aliases: it would just use the dependency that had been previously installed into With using aliases: It always checks the repository first, even though the alias target is already installed into I'd just like the same behavior for both – If I install a package, and its dependency is already present in
I don't want this package to be available in a registry, it is proprietary software that I am building and deploying locally.
Correct. And it works if I don't use aliases, but fails if I use aliases. I would just like it to work in both cases. 😊 |
Uh oh!
There was an error while loading. Please reload this page.
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
I have two local packages,
foo
andbar
, packed into separate.tgz
files.bar
depends onfoo
.foo
bar
foo
.Now I update
bar
to depend onfoo
with a package alias:foo
bar
bar
from 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
The text was updated successfully, but these errors were encountered: