Can I run a private npm repository without replicating the public repository?
NickName:Quentin Ask DateTime:2013-01-31T00:42:01

Can I run a private npm repository without replicating the public repository?

I'm writing a number of pieces of code (for internal use) using node.js and want to store the modules (packaged up for npm) in a package repository for each distribution to the various machines they will be installed on.

Ideally, I'd like a solution similar to Debian's apt repositories in which I can run a private repository server and configure npm to use a list of repositories to install from (When installing "foo", if "foo" is known by my private server install it from there, otherwise install it from the public server).

However, it looks like the npm registry configuration key only accepts a single URL.

Is there a way to achieve what I want?

The closest I've been able to find have been:

  • Mirroring the public repository locally and adding my packages on top of it… but I don't want to keep that amount of data (2.5G and still downloading) replicated on AWS.
  • Hosting all my packages in git repositories and installing from there (which is more of a hassle).
  • Hosting static packages on HTTP (as far as I can tell, this would prevent me from automatically getting "the latest version". I suppose I could do something with symlinks, but that is still less flexible than git, requires full URLs (which need to be kept up to date), and doesn't give a searchable repository.

Copyright Notice:Content Author:「Quentin」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/14609131/can-i-run-a-private-npm-repository-without-replicating-the-public-repository

Answers
David Weldon 2013-01-30T17:55:39

Based only on listening to a recent episode of NodeUp (#37?), I think you may want to have a look at irisnpm. From what I remember it's a service which gives you a merged set of the public modules and your own private modules.",


Paul Verest 2013-02-26T09:10:12

As Dominic Barnes suggested, we can replicate only _design documents (CouchDB table schemes)\n\nHow to replicate design documents only?\n\nHowever, it needs to check if some data needed.",


Pascal Belloncle 2013-01-30T20:48:29

In your package.json, you can use any url that points to a valid npm packed module. I use an s3 with a bucket name that is hard to guess.\n\nnpm pack\ns3cmd put *.tgz s3://path-to-your bucket\n\n\nS3 is just an example, you could use any mean that can place a file on a web server, it can even be protected via basic auth.",


user605331 2014-04-03T16:19:45

I believe Paypal's Kappa project would suit your need.\n\nHere is an article describing Paypal's Kraken project and how Kappa fits in.\n\nI understand it wasn't available at the time of Quentin's question, but perhaps this will be useful for others that come along here.",


xmojmr 2014-07-10T18:54:42

npm-registry-client GitHub issue #42 lists several ways how to create your own repository mirror. namely:\n\n\nhttps://github.com/cnpm/cnpmjs.org\nhttps://github.com/rlidwka/sinopia\n\n\nhttps://github.com/rlidwka/sinopia#similar-existing-things\n\nhttps://github.com/davglass/registry-static\n\n\nOverall it seems to me that you can get best answers by searching through issues in repositories owned by https://github.com/npm or by asking your question there",


More about “Can I run a private npm repository without replicating the public repository?” related questions

Can I run a private npm repository without replicating the public repository?

I'm writing a number of pieces of code (for internal use) using node.js and want to store the modules (packaged up for npm) in a package repository for each distribution to the various machines the...

Show Detail

How to create smart LAN or company npm registry (node.js package repository)?

How to create smart local network or company npm registry (node.js package repository)? It should be not mirror, but proxy that fetches only needed packages on required basis. Just like in Java wo...

Show Detail

How to config several private repository and public repository in npm?

I want to run npm install and to have multi repositories to get dependencies. The logic that I want first to look on public Nexus and just if it didn't find the artifact look for my private Nexus. ...

Show Detail

Merge public repository with private repository

I have a private repository generated from a public repository. How can I merge updates of the public repository with the private repository without removing additional files?

Show Detail

Difference between private npm repository and private npm registry

I hear people talking about private npm repository and private npm registry. I wonder what is the difference between the two? Also is private npm repository same as local npm repository? Is local npm

Show Detail

Authentication error on publishing to private NPM repository on Nexus

I am having authentication problem when publishing to my private npm registry hosted on my private Nexus. My Nexus setup is I have npm-proxy, npm-registry (hosted npm with allowRepublish=false), npm-

Show Detail

Offline private NPM repository

I read about building private NPM mirrors/repositories, but didn't quite understand. My goal is to make a repository that currently up to date, that contains all NPM packages available at the NPM

Show Detail

NPM install from private gitlab repository

I have a private gitlab repository with deploy token set up. My first though was that private repository can not be reached without that token, however there is no issues reaching and installing code

Show Detail

Cannot install npm packages from Sonatype Nexus private repository

I am using Sonatype nexus as my repository where I have configured npm to have public and private repositories. npm-public -> proxy for npm registry. npm-private -> private repository to pub...

Show Detail

install npm package from private github repository npm ERR! code ENOENT

i'm trying to install a npm package from private repository github of my organisaion with npm install, but i still have a npm ERR! code ENOENT How can i configure my npmrc to say that i would install

Show Detail