Can/Should gulp livereload be installed globablly

84 views Asked by At

I am new to Node and I don't fully understand yet what installing locally means exactly. I know I need to install gulp both globally as well as locally but in my case I have a number of projects in separate folders under a development folder and I wonder if I really need to install the livereload extension locally in each separate project folder (which is what the documentation seems to suggest) would it not be easier to install it globally; or locally in the main development folder. Can someone explain how this works and what options I'd have.

Similarly I wonder whether if I install gulp locally in the development folder will this be available to each of it's children or whether I'd again need/want to install it in each project folder locally.

2

There are 2 answers

0
ckross01 On BEST ANSWER

Here is an, albiet old, article on the node js blog that goes over locally vs globally. http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation

The basics are that if you want to require require('gulp-livereload') inside of your code it should be a local (dev) dependency. If you wish to interact with the module via the cli then install globally. For example you might have both gulp and nodemon installed globally.

The point of local install is that someone can bring down your project, type 'npm install' and get all of the dependencies local to that app.

So to answer your question install gulp-livereload locally. But other modules such as gulp, nodemon, etc you would have both global and local.

As an extra help if you want to install gulp as a project dependency but have it globally as well you can run 'npm link gulp' in order to keep them in sync.

0
Ghidello On

Also, you can have just one global version while, using the local one, you can use for a specific project the specific version used while developing it.