npm: dependencies and devDependencies


From the npm doc, we can get:

If someone is planning on downloading and using your module in their program, then they probably don't want or need to download and build the external test or documentation framework that you use.
In this case, it's best to list these additional items in a devDependencies hash.

In a word, packages only used in the development phase should be listed in the devDependencies hash.

relation between dependencies and devDependencies

  • In the root of the package, npm install will install both devDependencies and dependencies, otherwise it will only install dependencies, such as grunt-plugin
  • npm install --production or with the NODE_ENV environment variable set to production will only install dependencies


comments powered by Disqus