Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does npm -D flag mean?

Tags:

npm

People also ask

What is G flag in npm install?

npm install -g. the -g flag is a shorthand for the global configuration which sets the package install location to the folder where you installed NodeJS. This is useful when you need to run the package from the command line instead of using require() and import it to your code.

What does the -- Save flag do npm?

npm install <package_name> --save installs the package and updates the dependencies in your package. json. Since this question was asked there was a change to npm, such that --save has become the default option, so you do not need to use --save to update the dependencies.

Do you need save flag npm?

You don't need --save anymore for NPM installs. This was long the golden standard to install a package and save it as a dependency in your project. Meaning if we didn't specify the --save flag, it would only get locally installed and not added to the package.


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.


As described in the NPM Install Docs:

-D, --save-dev: Package will appear in your devDependencies.

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