

$ npm install -S bahmutov/private-module-example#1.0.0Īdded 1 package from 1 contributor and audited 1 package in 6.961s Only instead of the package name, I can specify GitHub username and repository name, instead of the version, I can specify a commit SHA or a tag. The install command looks almost the same as "standard" npm i. "description" : "Private repo that uses another private repo as an NPM module" , I have created another private GitHub repository bahmutov/private-module-example-user - this repo will install the code from the first repository without going to NPM. Great, I have 1 release in my private GitHub repository. Then I created a tag (same as version) and pushed it too 1 "test" : "echo \"Error: no test specified\" & exit 1" "description" : "Private module installation example" , The package.json sets the private: true to avoid accidentally publishing this package to the NPM registry.

I can load this module locally from the project's root folder 1 log( 'this module will export stuff from "foo"') It contains a small JavaScript export just for show. I made a private repository bahmutov/private-module-example on GitHub. Why bother if it might not work out? Here is how you can quickly push code to a private GitHub repository yet make it available to other projects. Maybe you are just experimenting, and setting things up takes effort. Let's say you have some JavaScript code you want to share among several projects, but you don't want to create a private NPM package yet.
