NPM INSTALL FROM GITHUB PACKAGE JSON INSTALL
You can optionally specify different paths for package.json: npm-git install -c git-dependencies.json In effect you will get your dependency properly installed. Then run npm install in your project path. Which will trigger prepublish hook of the package being installed. This simple script will do the following for every of gitDependencies section of package.json:Ĭlone the repo it into temporary directory
npmignore, which will most likely remove all your source files and make it hard to recover. One would expect that running npm install would also run prepublish before installing. some-local-directory/my-package then npm will run prepublish script of the my-package and then install it in current project. Here is relevant issue with ongoing discussion. Because of that some authors are keeping build artifacts in the repos, which I would consider a hurdle at best. It basically prevents us from installing anything that needs a build step directly from git repos. IMO there is a serious defect in current versions of NPM regarding installation process of dependencies from git repositories. Now it should be easy to deploy, as long as the git executable is available in the environment. node_modules/.bin/npm-git install -save is probably the safest option, as it guarantees the same revision to be installed every time. You can also add a dependency and lock it's sha in one go.
This will reinstall all git dependencies, but also write last matching commit's sha to package.json, effectively locking the versions. If you want to lock versions of git dependencies, use. Then install your dependencies as usual: npm install one that you would provide to git clone on command line) - no fancy NPM shortcuts like user/repo or bitbucket:user/repo. Obviously replace *-package-name and git URLs with values relevant to your project.
Install npm install -save npm-git-install It is meant as a temporary solution until npm/npm#3055 is resolved. Clones and (re)installs packages from remote git repos.