As Node.js is becoming a mainstream technology in the enterprise, more companies are asking for a private npm registry solution for their proprietary closed-source modules.
While there are several solutions emerging that offer a private npm registry server (either in the cloud or on premise), we at StrongLoop feel the private registry server is only one part of the story.
The second part is switching your npm client configuration between multiple registries. Why would you want to use multiple registries? There are several reasons; for example:
- Some of your modules are open source and thus published to the public npmjs.org registry and others are private and published to your private registry.
- You have multiple private registries: for example a company-wide registry for stable versions of modules and multiple per-team registries with nightly builds of each module.
Previously, many developers used the npm config command to switch between different registry servers:
$ npm config set registry https://your.registry.url/
This solution has few drawbacks:
- It ignores the fact that there are multiple configuration options that differ between registry servers, e.g. username and password. You must change these options too when switching to another registry.
- You have to recall and re-type the correct registry URL every time you change your registry server.
The module npmrc provides a better solution. It maintains a set of npmrc files (one npmrc for every registry) and you switch between them using a single command. However it is still not perfect, as the general options like “browser” or “git” are not shared across different configurations as they should be. Read more