Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 
like image 552
futlib Avatar asked Apr 30 '12 15:04

futlib


People also ask

Can you make a private NPM package?

With npm private packages, you can use the npm registry to host code that is only visible to you and chosen collaborators, allowing you to manage and use private code alongside public code in your projects. Private packages always have a scope, and scoped packages are private by default.

Where can I host npm private packages?

If you want to host a private NPM package but do not want to pay US$ 7 per user, per month to host it directly at https://www.npmjs.com/ this post is for you.


1 Answers

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",     } } 
like image 148
250R Avatar answered Oct 18 '22 04:10

250R