-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
npm install - --registry parameter not respected #3235
Comments
The registry setting will only inform npm where to pull packages via name. Once the package-lock is made, that is where things will be pulled from. If you want them to be different you will need to bypass the package-lock. |
@wraithgar Ok. Although this is frustrating as v6 did not work in this way and there was no documentation of this rather major change in the v7 release notes. |
@wraithgar thst does seem like a bug; my understanding is that npm is supposed to ignore the URLs in the lockfile and defer entirely to the registry settings in config. |
Can someone confirm if this is intended or a bug? We are transitioning some of our software so currently our CI process installs from a different registry than developers for a specific scope. It seems like the the only way to resolve this case is to ignore the package-lock or find / replace the registry in the package-lock, is that right? |
@wraithgar - as this has been reopened, are we acknowleding this is an issue? |
I don't know. I opened it because it is something people are still confused about one way or the other and it needs to be in our backlog to investigate. |
I think people are confused because it does not work in the same way as v6. Which is fine if the mechanics have changed, but would need to be documented. |
We've just been hit by this. This completely block our continuous deployment for a use case that I'm sure is not uncommon:
We rolled out Node 16 (so also npm@8) yesterday just to discover this. This important breaking change can only be noticed by comparing documentation pages between npm@6 and npm@8 (https://docs.npmjs.com/cli/v6/using-npm/registry vs. https://docs.npmjs.com/cli/v8/using-npm/registry) Also there's no workaround given. Can you either
Thanks. Regards, |
We worked around this in the end by using this package in our CI build to modify the lock file without having to delete/recreate it. Not ideal but it works. https://www.npmjs.com/package/lock-treatment-tool |
Yep, I just |
This is expected behavior, the documentation expands a bit further on it in Configuring npm > package-lock.json:
The historical reason for the breaking change is trying to provide a more clear and safe usage of the These changes are part of our continuing efforts to improve the UX of lockfiles and we currently have some initiatives exploring better solutions, primarily the Resolved registry overrides RFC by @everett1992. I'll close this issue as it seems it will not get much more traction and it's not an actual bug to fix but to anyone still interested in improving the usage of the |
This issue should be re-opened, as it clearly is a BUG in the CLI. Command line parameters are the ultimate overrides, this is world standard in software. If the override can't be applied, or is invalid, the CLI has to throw an error to that effect, not ignore it. FYI: I'm facing the same issue, where I use local Verdaccio and try to publish with: |
Is there an existing issue for this?
Current Behavior
I have created this repository to demo the issue:
https://github.com/leepowelldev/npm-registry-issue
The scenario is a developer is working on an internal network with a local, non-public registry. They install the popular
rimraf
package from via local registry, and then deploy to the cloud to build and deploy. Their cloud pipeline task is setup to use the public npm registry.However the install fails as npm keeps trying to access the packages from the internal registry, even though an alternative one was specified.
This works as expected when using npm v6, however fails when using npm v7.
Expected Behavior
npm should transparently use the specific registry as v6 did
Steps To Reproduce
Instructions in repo README
Environment
The text was updated successfully, but these errors were encountered: