admin管理员组

文章数量:1296400

From the documentation, .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?

From the documentation, https://github./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?

Share Improve this question edited Nov 14, 2015 at 6:47 guagay_wk asked Nov 14, 2015 at 6:25 guagay_wkguagay_wk 28.1k64 gold badges200 silver badges309 bronze badges 7
  • May I ask why the negative vote? What is wrong with the question? – guagay_wk Commented Nov 14, 2015 at 6:37
  • I guess because of: stackoverflow./questions/27897038/why-need-npm-save-dev – weirdpanda Commented Nov 14, 2015 at 6:41
  • 1 have a look at stackoverflow./questions/19223051/… – Don Commented Nov 14, 2015 at 6: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 Commented Nov 14, 2015 at 6:44
  • My question asks why not just --save? Some difference. – guagay_wk Commented Nov 14, 2015 at 6:45
 |  Show 2 more ments

2 Answers 2

Reset to default 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:

  • Grunt.js: What does -save-dev mean in npm install grunt --save-dev
  • What is difference between --save and --save-dev?

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

本文标签: javascriptWhy does gulp need to be installed with savedev and not just saveStack Overflow