When you install a node module, NPM gets the package from the default registry:
https://registry.npmjs.org
My company is hosting its own node registry and I want use it. How can I force NPM to use this local registry.
I don't want to use npm install --registry
option.
Is there a way to make all the users on a specific machine to use this internal registry?
What worked for me was, I ran following command :
npm config set registry PATH_TO_YOUR_LOCAL_REGISTRY
Another option is to create a .NPMRC
file and put it into your project root directory. As mentioned in this link project specific npmrc file will take the highest priority & it will override other configuration. In this file just update the registry.
In npmrc file, add following:
registry = "https://path to local registry"
You don't have to use the --registry
option–you can just set the package.json
to point to your internal repository [0]:
Set "private": true
in your package.json
to prevent your package from being published, and set:
"publishConfig": {
"registry": "http://my-internal-registry.local"
}
to force it to be published only to your internal registry.
[0] https://docs.npmjs.com/misc/registry#i-dont-want-my-package-published-in-the-official-registry-its-private
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With