Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install an npm package from GitHub directly

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 from GitHub?

Here is the console output:

npm http GET https://github.com/visionmedia/express.git npm http 200 https://github.com/visionmedia/express.git npm ERR! not a package /home/guym/tmp/npm-32312/1373176518024-0.6586997057311237/tmp.tgz npm ERR! Error: ENOENT, open '/home/guym/tmp/npm-32312/1373176518024-0.6586997057311237/package/package.json' npm ERR! If you need help, you may report this log at: npm ERR!     <http://github.com/isaacs/npm/issues> npm ERR! or email it to: npm ERR!     <[email protected]>  npm ERR! System Linux 3.8.0-23-generic npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "https://github.com/visionmedia/express.git" npm ERR! cwd /home/guym/dev_env/projects_GIT/proj/somename npm ERR! node -v v0.10.10 npm ERR! npm -v 1.2.25 npm ERR! path /home/guym/tmp/npm-32312/1373176518024-0.6586997057311237/package/package.json npm ERR! code ENOENT npm ERR! errno 34 npm ERR! npm ERR! Additional logging details can be found in: npm ERR!     /home/guym/dev_env/projects_GIT/proj/somename/npm-debug.log npm ERR! not ok code 0 
like image 637
guy mograbi Avatar asked Jul 07 '13 05:07

guy mograbi


1 Answers

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

git+https://github.com/visionmedia/express.git 

or this flavor if you need SSH:

git+ssh://[email protected]/visionmedia/express.git 
like image 56
Peter Lyons Avatar answered Oct 17 '22 08:10

Peter Lyons