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

Do you still need --save-dev?

I get this error (on a Mac)

npm ERR! Darwin 16.7.0 npm ERR! argv "node" "/usr/local/bin/npm" "install" "gulp" "--save" "dev" npm ERR! node v0.10.25 npm ERR! npm v3.7.3 npm ERR! code EBADPLATFORM

npm ERR! notsup Not compatible with your operating system or architecture: inotify@1.4.2 npm ERR! notsup Valid OS: linux npm ERR! notsup Valid Arch: any npm ERR! notsup Actual OS: darwin npm ERR! notsup Actual Arch: x64

This discussion talks about "dev" being depreciated:

https://stackoverflow.com/questions/45629353/unsupported-in-mac-inotify1-4-1

When I run "npm install gulp --save" it installs Gulp and lots of Node modules successfully, and I also see this in my package.json file:

"dependencies": { "gulp": "^3.9.1" }

So is "dev" either depreciated or now not needed?

Thanks

Ari Misha
Ari Misha
19,323 Points

Hiya there! Did you try installing it globally? Its just that your node/npm cant reference to the gulp file in your project. Just install it globally and you can use it without referencing the gulp file in node modules everytime. Installing it globally isn't a recommended advice but i saves you a lotta hassle and you wont run into errors either.

~ Ari

Thanks Ari. I did installed Gulp globally after running updates on NPM and Node via Homebrew. After these actions it cleared the errors.

1 Answer

Neil McPartlin
Neil McPartlin
14,662 Points

Hi David. I normally work on a Windows machine, but I tried this on a Mac and it worked fine. The correct command is

npm install gulp --save-dev

I was curious about this part of your error message. npm ERR! Darwin 16.7.0 npm ERR! argv "node" "/usr/local/bin/npm" "install" "gulp" "--save" "dev"

and wondered why was 'save' and 'dev' separated by a space and not '-'. So I tried running npm install gulp --save dev and sure enough, I got the same error message as you.

As you say, you have installed gulp successfully locally and you needed to have it installed globally too anyway.

Adding --save simply adds gulp to your package.json file and shows it listed under 'dependencies', and using --save-dev also adds gulp to the same file but lists it under 'devDependencies'.

Here is my package.json file.

{
  "name": "treehouse-gulp-basics",
  "version": "1.0.0",
  "description": "Code for my Treehouse Gulp.js course!  June, 2015.",
  "main": "index.js",
  "dependencies": {},
  "devDependencies": {
    "gulp": "^3.9.1"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/hdngr/treehouse-gulp-basics.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/hdngr/treehouse-gulp-basics/issues"
  },
  "homepage": "https://github.com/hdngr/treehouse-gulp-basics#readme"
}

By doing this, it is possible to run a particular `npm install' command that only installs 'dependencies' required for a production environment, and excludes 'devDependencies' which are only required during the development and testing phase.

As for the Stackoverflow post you found, you were unlucky there because there is also a package called 'dev'.

https://www.npmjs.com/package/dev

So this was a 'red herring'.