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
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.
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.
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", } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With