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 6.3k times
202
simplesthing
- 2,506
- 3
- 13
- 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
-
2@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
3 Answers
239
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.
-
31
-
@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
-
3
27
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
- 5,645
- 1
- 30
- 30
Joniras
- 1,079
- 9
- 30
-
1Adding to this, the equivalent using yarn is `yarn add
[--dev/-D]` – Arian Acosta Aug 22 '19 at 15:30
-9
Flag -D is often used along with i which stands for "install"
For example:
npm i -D package-name
oabarca
- 10,186
- 6
- 56
- 69
-
And `-D` do what? (as asked on the question and already answer by others) – user Apr 16 '20 at 03:04