Skip to content
This repository has been archived by the owner. It is now read-only.

No way to override registry in .npmrc for scoped packages w/--registry flag #10117

Closed
brianreavis opened this issue Oct 26, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@brianreavis
Copy link

commented Oct 26, 2015

I have a scoped package that I want to publish publicly to the main NPM registry. The problem is: I have that scope set up in .npmrc, set to a private registry (to act as a default). With npm there seems to be no way to override this when publishing. I've tried setting --registry and publishConfig.registry to "https://registry.npmjs.org/" and neither override it (npm v3.3.9)

Semi related: #5522

@mhofman

This comment has been minimized.

Copy link

commented Apr 14, 2016

I just found out that using publishConfig["@scope:registry"] properly overrides the .npmrc scoped registry value

@KidkArolis

This comment has been minimized.

Copy link
Contributor

commented May 23, 2016

Just ran into this issue - we find it very surprising that command line argument --registry does not override the scope registry specified in ~/.npmrc.

@othiym23 would you accept a PR where --registry cli arg overrides the registry specified in '~/.npmrc'? I don't know how the publishConfig setting should behave..

The boring details: We use an internal npm registry and by default everyone has it configured for our scope in ~/.npmrc. However we also use dev and staging registries (since this registry is part of our application functionality) and we want to be able to override this for our QA process. It seems that this used to work in an old npm@2.14.9.

@mhofman

This comment has been minimized.

Copy link

commented May 23, 2016

@KidkArolis , it does work, you have to use --"@scope:registry=registryURL", not --registry=registryURL.

What doesn't work is overriding publishConfig["@scope:registryURL"] using --"@scope:registry=registryURL"

@KidkArolis

This comment has been minimized.

Copy link
Contributor

commented May 23, 2016

Oh, awesome! Thanks for the clarification!

@brianreavis

This comment has been minimized.

Copy link
Author

commented May 23, 2016

Thanks for clearing this up @mhofman! I suppose this is safe to close now. Out of curiosity, is there somewhere you found this documented?

@mhofman

This comment has been minimized.

Copy link

commented May 23, 2016

I honestly don't remember. I might have guessed it from how npm structures the npmrc file knowing that all lines in there are actually parsed the same as command line parameters.

It might be good for the docs to make this a little more clear.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.