I am about to install this npm package and it says npm install -D load-grunt-config
. What does the -D
flag do?
Asked
Active
Viewed 9.2k times
254

Pang
- 9,564
- 146
- 81
- 122

simplesthing
- 3,034
- 3
- 15
- 16
-
Sorry for duplicate question, http://stackoverflow.com/questions/8783230/what-is-the-d-in-npm-d-install has answer, however the comments are much more inline, I guess because they were made by developers that knew the answer and had been through the same. – simplesthing Apr 20 '14 at 01:18
-
1you can find the answer here https://stackoverflow.com/a/60538593/8134164 – INDRAJITH EKANAYAKE Mar 05 '20 at 05:36
-
Does this answer your question? [What is the "-d" in "npm -d install"?](https://stackoverflow.com/questions/8783230/what-is-the-d-in-npm-d-install) – INDRAJITH EKANAYAKE Mar 05 '20 at 05:37
-
3@IndrajithEkanayake `-D` is different from `-d`. – thdoan Feb 03 '21 at 00:43
-
@thdoan yes they are different – INDRAJITH EKANAYAKE Feb 03 '21 at 07:38
2 Answers
296
The -D
flag is the shortcut for: --save-dev
. Source: https://docs.npmjs.com/cli/install
-D, --save-dev: Package will appear in your devDependencies.

Jaime Gómez
- 6,961
- 3
- 40
- 41

sagunms
- 8,030
- 5
- 41
- 43
-
54
-
@kevin: http://stackoverflow.com/questions/19223051/grunt-js-what-does-save-dev-mean-in-npm-install-grunt-save-dev – spb Mar 18 '16 at 18:48
-
3For me, the -D flag will not update package.json, forcing me to use --save-dev instead. Crazy as usual :( – Agustin Garzon Oct 27 '17 at 14:44
-
1
-
4
37
As described in the NPM Install Docs:
-D,
--save-dev
: Package will appear in yourdevDependencies.
Which means that the package will not be installed if you do npm install --production
.
A detailed explanation of the different types of dependencies: SO-Answer

Arian Acosta
- 6,491
- 1
- 35
- 32

Joniras
- 1,258
- 10
- 32
-
1Adding to this, the equivalent using yarn is `yarn add
[--dev/-D]` – Arian Acosta Aug 22 '19 at 15:30