npm install a package from GitHub

Did you know that you’re not limited to installing Node.js packages from the npm registry?

You can also install packages from remote git providers like GitHub.

Here’s how you do it:

$ npm install
# npm install<username>/<repository>

What npm will try to do is install the package via a git clone.

The default commit is master, but if you want to install a specific commit or tag, you can do the following:

$ npm install remarkablemark/html-react-parser#v0.0.5
# npm install <username>/<repository>#<commit>

And you can even install a package from a gist:

$ npm install gist:fd0837438d136e18c8e8eac559cd004a
# npm install gist:<commit>

Check out the npm-install documentation for more information.