Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using NPM package which requires prepublish/build from Git

Tags:

npm

Currently NPM does not run prepublish after installing a package from a Git repository. When working with a team (i.e: I cannot ask team members to run npm install specifically on a dependent package), how can I use a package that requires a build step when installing from a Git repo?

like image 272
Alon Burg Avatar asked Feb 11 '16 13:02

Alon Burg


People also ask

How do I add a Git repo to a npm package?

To npm install a public project that is hosted on Github, and not the NPM registry, add the Github repo to package. json dependencies using the username/repo#branch-name format. Run npm install and npm will download the project and save it into your /node_modules/ folder.

Do I need to build before npm publish?

json and publish it to npm using the same version. You can't publish again using the same version, or a previous one. You can read more about versioning here. Don't forget to build before publishing.

Does npm use Git?

npm install : Installs the package from the hosted git provider, cloning it with git.


1 Answers

You can try this: https://www.npmjs.com/package/npm-git-install

It requires nodegit, so you'll have to be able to install that as well on your system.

like image 184
blockhead Avatar answered Oct 07 '22 04:10

blockhead