How to install an npm package from Github directly

Overview

NPM or Node Package Manager is a package manager generally used to publish or install node packages. We are all used to installing npm packages using the npm install command.

For example, to install the express module, we can perform the following:

npm install express

Installing NPM package directly from Github

npm install git+ssh://git@github.com:expressjs/express.git

Installing the package from a branch on Github

npm install git+ssh://git@github.com:expressjs/express.git/tree/{BRANCH}

Conclusion

Being able to download packages from Github allows us to download packages that may be private. That may be partially worked on, and hence cannot be uploaded to npm registry.