node.jsrepositorynpm

can you host a private repository for your organization to use with npm?


Npm sounds like a great platform to use within an organization, curious if a private repo is possible, like with Nexus/Maven. Nothing comes up on Google :(


Solution

  • I don't think there is an easy way to do this.

    A look at the npm documentation tells us, that it is possible:

    Can I run my own private registry?

    Yes!

    The easiest way is to replicate the couch database, and use the same (or similar) design doc to implement the APIs.

    If you set up continuous replication from the official CouchDB, and then set your internal CouchDB as the registry config, then you'll be able to read any published packages, in addition to your private ones, and by default will only publish internally. If you then want to publish a package for the whole world to see, you can simply override the --registry config for that command.

    There's also an excellent tutorial on how to create a private npm repository in the clock blog.

    EDIT (2017-02-26):

    Not really new, but there are now paid plans to host private packages on npm.

    Over the years, npm has become a factor for many non-Node.js companies, too, through the huge frontend ecosystem that's built upon npm. If your company is already running Sonatype Nexus for hosting Java projects internally, you can also use it for hosting internal npm packages.

    Other options include JFrog Artifactory and Inedo ProGet, but I haven't used those.