How to install an npm package from GitHub directly?

Question:

Trying to install modules from GitHub results in this error: ENOENT error on package.json.

Easily reproduced using express:

npm install https://github.com/visionmedia/express throws error.

npm install express  works.

Why can’t I install it from GitHub?

Answer:

Because https://github.com/visionmedia/express is the URL of a web page and not an npm module. Use this flavor: git+{url}.git

or this flavor if you need SSH:

Leave a Reply