Why set up a remote npm registry?
In the world of package management and version control, a “remote” repository or registry is one that is hosted on an external machine or network. This is contrasted with a “local” repository or registry that is located on your own machine.
How to set up a remote npm registry
To set up a remote npm registry, you’ll first need to choose the location where your packages will be hosted. You can host an npm registry within your own infrastructure on-premises or in the cloud. There are also various third-party solutions that handle the task of hosting for you.
Assuming you’ve chosen the do-it-yourself route, you’ll first need to set up a database to contain the packages. According to npm, the npm public registry is powered by an Apache CouchDB database, with a public mirror available at the URL https://skimdb.npmjs.com/registry. You can install CouchDB here. You’ll also need to set up a server to host the package database (e.g., using Node.js).
The final step is to configure npm to point to your remote registry. You can do this by editing the ~/.npmrc file to contain the line:
registry = URL
URL points to your CouchDB database.
If you need help setting up a remote npm registry or you use multiple programming languages, it’s a smart choice to go with a dedicated package management solution. Tools such as Packagecloud include built-in support for npm registries, as well as packages in languages such as Python, Ruby, and Java.