Reputation: 355
I am setting up nexus npm repository, and created npm-group = npm-private+npm-registry (proxy to npm offical registry).
It comes to me thinking that if I publish my own package and name it say "jest" to my private repo, what happens if I do npm install jest? Does it take the private fake one or the one published in official site?
Thanks
Upvotes: 0
Views: 1274
Reputation: 1801
You need to use scopes for your private packages. You prefix them with @yournamespace (for instance: "name": "@yournamespace/jest"
), and you adjust your npmrc accordingly:
; Set a new registry for a scoped package
@yournamespace:registry=https://mycustomregistry.example.org
Using this scheme, you could use separate npm repositories, one for the proxy to the official npmjs repo, and one for your private packages.
Otherwise, if you override a package name, it will shadow the one that is proxified, so you will fetch your private package instead of the official one.
Upvotes: 2