Learning Node? Download my free Node and Express Handbooks 🔥
When you install an npm package using
npm install <package-name>, you are installing it as a dependency.
The package is automatically listed in the package.json file, under the
dependencies list (as of npm 5: before you had to manually specify
When you add the
-D flag, or
--save-dev, you are installing it as a development dependency, which adds it to the
When you go in production, if you type
npm install and the folder contains a
package.json file, they are installed, as npm assumes this is a development deploy.
You need to set the
--production flag (
npm install --production) to avoid installing those development dependencies.