guagay_wk
guagay_wk

Reputation: 28098

Why does gulp need to be installed with --save-dev and not just --save

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?

Upvotes: 3

Views: 4730

Answers (2)

Shashank
Shashank

Reputation: 13869

--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:

Upvotes: 9

guagay_wk
guagay_wk

Reputation: 28098

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

Upvotes: 1

Related Questions