What is the NPM Registry, and why would I want to change it?

Brent Reno

We’ve all used NPM before, but where is all that information coming from? Enter the NPM registry, which allows for packages to be resolved by name and version, allows for package publishing, and user account management. You can read the official docs here . For most projects, the public registry is exactly what you need, and is the default registry of NPM. However there are situations where a private registry is needed. Creating a private registry is another post for another day. So we will skip over that and get right to a use case. Let’s say your company has created a Node package that contains proprietary information, or for some other reason you don’t want it to be public. Great add it to your private registry. And now all your developers can use it, not exactly. NPM will still be communicating with the default registry, and with throw an error on NPM install of the private package. No worries, it’s easy to fix, just run–

NPM config set registry https://privateregistryurl.com/.

Run install again, and your project should be up and running. When you are done using the private registry, simple run the config again changing the url back to the default NPM registry–

NPM config set registry https://registry.npmjs.org/.

Last updated by on .

What Are Your Thoughts?

Your email address will not be published. Required fields are marked *