JavaScript Gulp Basics Welcome to Gulp.js Installing Gulp

Kevin Collins
Kevin Collins
15,354 Points

Gulp global install - gulp vs gulp-cli

It would seem that recommended practice now is to use the global install gulp-cli instead of gulp. Anyone have any input on this? If that is the case maybe that could be added to the teacher's notes?

Right from the Gulp github page:

  1. Install gulp globally:

If you have previously installed a version of gulp globally, please run npm rm --global gulp to make sure your old version doesn't collide with gulp-cli.

npm install --global gulp-cli

1 Answer

Daniel Jenkins
Daniel Jenkins
17,713 Points

There's a growing consensus that it's better not to globally install packages that your projects depend on. This is mainly due to the fact that these won't show up in your project's dependency list. If you're sharing your code this means you need to explicitly state that your project has dependencies beyond the dependency file itself.

Further complicating matters is that you might leave a project alone for some time and update your global package installation to some new version that isn't compatible with the version used in your project, causing conflicts when you revisit it.

As I understand it gulp-cli directly addresses these issues in that it allows you to run a local installation of gulp as though it were a global installation by providing shell access.

Hope that makes sense!