1

The npm docs state that npm install by default installs both dependencies and devDependencies listed in your package.json. If you want to only install dependencies then use the --production flag.

When you install a package then the docs state

NOTE: The --production flag has no particular meaning when adding a dependency to a project.

My question is regarding the package your installing's dependencies. Does its devDependencies get installed?

What about when you install a package globally using npm install -g <package_name>?

This question discusses devDepedencies when installing your own dependencies from package.json, but not about what occurs when installing a specific package.

shmuels
  • 1,039
  • 1
  • 9
  • 22
  • The documentation looks confusing in that regard but it seems that it depends entirely on the production flag, and that the flag is ignored only when adding a new library to a project, not when adding a global one or fetching missing things. – Alejandro Mar 31 '22 at 14:05
  • This would mean that when installing a package globally it installs devDependencies. Would that make sense, why would I need a package's devDependencies to be installed? – shmuels Mar 31 '22 at 14:15

0 Answers0