Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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!