Running npm publish in a package's directory will get registry settings by reading the publishConfig section of package.json. However, running npm unpublish does not look in package.json and instead uses the default global registry.
Would you accept a patch to make npm unpublish's registry configuration registration behave like npm publish?
That would make sense to me.
@jden did you send a patch ?
@matthiasg never heard back; didn't write a patch
Why that was closed?
@Evgenus this is superseded by supporting a per-project .npmrc file (#5077). You can set registry = or @scope:registry = in there.
Or, rather, it was handled on #4751.
per-project .npmrc is not the solution for this bug IMO. The use case "I do want to fetch from one registry, but am publishing to another one" is still broken.
A project being set up using publishConfig in package.json, as it was the recommended way by npm doco is still broken, it cannot properly unpublish.
Or is there another way to make npm fetch from one registry but publish to another I am not aware of?
This is what I get for reading the body of an issue (which had a very important typo before I fixed it) and not looking carefully at its title. While this bug / feature request is not a big, earth-shattering deal, I am generally sympathetic to the idea that operations inside npm should be symmetric. As such, if npm publish reads publishConfig data, then so should npm unpublish. That doesn't mean that I'll have time to get to it anytime soon, though, so if somebody (@jden?) wants to take a whack at putting together a PR, I'd be happy to work with them to land it.
Is there some update on this?
I no longer have the multiregistry use case, nor the time to put together this PR, although I am generally in favor of the npm client being multi-registry friendly and being able to control this via package.json.
I just tried to create a patch at #8013.
@watilde's patch was a good one, and so is landed as 18ce0ec. I still think that for most per-project configuration, .npmrc is a better place to put this configuration, but now npm publish and npm unpublish use the exact same logic to set the configuration from package.json's publishConfig stanza.