Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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:

https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md

  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,714 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!