Trying to install modules from github results in:
ENOENT error on package.json.
Easily reproduced using express:
Update September 2016
Installing from vanilla https github URLs now works:
npm install https://github.com/fergiemcdowall/search-index.git
EDIT 1: You can't do this for all modules because you are reading from a source control system, which may well contain invalid/uncompiled/buggy code. So to be clear (although it should go without saying): given that the code in the repo is in an npm-usable state, you can now quite happily install directly from github
EDIT 2: (21-10-2019) We are now living through "peak Typescript/React/Babel", and therefore JavaScript compilation has become quite common. If you need to take compilation into account look into prepare
. That said, NPM modules do not need to be compiled, and it is wise to assume that compilation is not the default, especially for older node modules (and possibly also for very new, bleeding-edge "ESNext"-y ones).
Simple :
npm install *GithubUrl*.git --save
example :
npm install https://github.com/visionmedia/express.git --save
Because https://github.com/visionmedia/express
is the URL of a web page and not an npm module. Use this flavor:
git+https://github.com/visionmedia/express.git
or this flavor if you need SSH:
git+ssh://git@github.com/visionmedia/express.git
Try this command
npm install github:[Organisation]/[Repository]#[master/BranchName] -g
this command worked for me.
npm install github:BlessCSS/bless#3.x -g
UPDATE now you can do: npm install git://github.com/foo/bar.git
or in package.json
:
"dependencies": {
"bar": "git://github.com/foo/bar.git"
}
You can also do npm install visionmedia/express
to install from Github
or
npm install visionmedia/express#branch
There is also support for installing directly from a Gist, Bitbucket, Gitlab, and a number of other specialized formats. Look at the npm install
documentation for them all.