-
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
[BUG] no way to npm publish
a tarball whose package.json includes publishConfig.registry to a private registry
#6400
Comments
Maybe someone will come in handy, here is an example for npm 8.19.3.
|
We have ran into this problem as well, as we need to publish packages to a private repo, and for some reason some packages have publishConfig.registry point to npm. |
@GideonMax, just wondering what was your workaround for this issue? of course, if your workaround doesn't involve editing *.tgz files) |
This PR addresses an issue where CLI flags were not taking precedence over publishConfig settings. To ensure CLI flags have higher priority, properties from the publishConfig object that also exist in CLI flags are filtered out. Related to #6400
Fixed by #7321 |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
You can download the original TGZ format of a package using
npm pack some-package
. You can then re-publish this to a different registry usingnpm publish some-package*.tgz --registry=https://path/to/my/registry
.This works great for almost every public package, but there are a few that specify a registry with
publishConfig.registry
in theirpackage.json
. The problem is thatnpm publish
peeks inside the tarball it's publishing to compute the final config used before uploading. I found this ancient, unresolved issue -- auto-closed while tagged "patch-welcome" -- about allowing the--registry
command line option to overrulepublishConfig.registry
. As far as I can tell, nothing was ever done about it, so there seems to be no way to override this value without editing the TGZ, but that will change itsintegrity
.Expected Behavior
It should be possible to publish a TGZ package to any registry using some version of
npm publish
. The simplest solution is probably to fix precedence for--registry
but any other workaround would also be acceptable.Steps To Reproduce
npm pack yargs
, thennpm publish yargs*.tgz --registry=https://path/to/my/other/registry
npm pack zone.js
, thennpm publish zone.js*.tgz --registry=https://path/to/my/other/registry
The first commands should succeed while the second one fails with the error
due to the custom registry here.
Environment
The text was updated successfully, but these errors were encountered: