3

From the documentation, https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md

$ npm install --save-dev gulp

All the npm modules which I have used so far installs using $ npm install --save <module_name>

Why --save-dev for gulp and not just --save? What is the difference between --save-dev and --save?

guagay_wk
  • 26,337
  • 54
  • 186
  • 295
  • May I ask why the negative vote? What is wrong with the question? – guagay_wk Nov 14 '15 at 06:37
  • I guess because of: http://stackoverflow.com/questions/27897038/why-need-npm-save-dev – weirdpanda Nov 14 '15 at 06:41
  • 1
    have a look at http://stackoverflow.com/questions/19223051/grunt-js-what-does-save-dev-mean-in-npm-install-grunt-save-dev – Don Nov 14 '15 at 06:42
  • I believe someone voted your question down (most probably) because the question already exists (with an answer) and insufficient research was done before posting this question. Thats my guess – Don Nov 14 '15 at 06:44
  • My question asks why not just --save? Some difference. – guagay_wk Nov 14 '15 at 06:45
  • I just saw the answer in another question. Yes, my question is a duplicate. – guagay_wk Nov 14 '15 at 06:47
  • @Don Jayamanne, i just saw the answer in the other question. Your comment is a good answer too. Thanks. – guagay_wk Nov 14 '15 at 06:49

2 Answers2

9

--save adds the package to your dependency list ("dependencies" in package.json). This is a list of only the dependencies that your package needs to run. These are the dependencies that need to be installed when a user installs your package from npm with the intent of using it.

--save-dev adds the package to your developer dependency list ("devDependencies" in package.json). This is a list of dependencies that you need only for developing the package. Examples would be like babel, gulp, a testing framework, etc.

For more information, check out the top two linked questions to this one:

Community
  • 1
  • 1
Shashank
  • 13,713
  • 5
  • 37
  • 63
1

This is a duplicate question. Answer can be found here. Grunt.js: What does -save-dev mean in npm install grunt --save-dev

Copy from the other link.


There are (at least) two types of package dependencies you can indicate in your package.json files:

1) Those packages that are required in order to use your module are listed under the "dependencies" property. Using npm you can add those dependencies to your package.json file this way:

npm install --save packageName

2) Those packages required in order to help develop your module are listed under the "devDependencies" property. These packages are not necessary for others to use the module, but if they want to help develop the module, these packages will be needed. Using npm you can add those devDependencies to your package.json file this way:

npm install --save-dev packageName
Community
  • 1
  • 1
guagay_wk
  • 26,337
  • 54
  • 186
  • 295