Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing a library with npm that is not a module

I working on a project that requires WebGazer.js (https://webgazer.cs.brown.edu/). I would love to somehow add this library to package.json so that all my libraries install with 'npm install' instead of having to call 'npm install' and then download webgazer separately.

Is there anyway to do this by including a link or something of that nature? I am new to npm so I have no idea where to even start or if this is even possible.

like image 826
user6509972 Avatar asked Oct 06 '16 03:10

user6509972


People also ask

Do I need to install node modules for every project?

Global installing dependencies puts the module into your Node. js path, which is Operating System dependent) and will be accessible from any project without the need to install it separately for each project while doing the setup.


1 Answers

npm install only works on modules. But, WebGazer has a package.json for NPM which is all you need. (The module doesn't need to be listed in the NPM repository.)

Try something like this:

npm install --save git+https://[email protected]/brownhci/WebGazer.git

If you actually had the problem you describe, you could set up a postinstall script to install anything else you needed, however you need it. https://docs.npmjs.com/misc/scripts

like image 147
Brad Avatar answered Nov 15 '22 00:11

Brad