How to install a private NPM module without my own registry?
I've taken some shared code and put it in an NPM module, one I don't want to upload to the central registry. The question is, how do I install it from other projects?
The obvious way is probably to set up my own NPM registry, but according to the documentation, that involves a lot of hassle.
Can I just install an NPM module that sits on the local filesystem, or perhaps even from git?
npm install --from-git git@server:project
In your private npm modules add
"private": true
to your package.json
Then to reference the private module in another module, use this in your package.json
{
"name": "myapp",
"dependencies": {
"private-repo": "git+ssh://[email protected]:myaccount/myprivate.git#v1.0.0",
}
}
cd somedir
npm install .
or
npm install path/to/somedir
somedir
must contain the package.json
inside it.
It knows about git too:
npm install git://github.com/visionmedia/express.git