Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.
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 --save).
When you add the -D flag, or --save-dev, you are installing it as a development dependency, which adds it to the devDependencies list.
Development dependencies are intended as development-only packages, that are unneeded in production. For example testing packages, webpack or Babel.
When you run npm install in a folder that contains package.json, npm installs both dependencies and devDependencies by default, assuming a development environment.
You need to set the --production flag (npm install --production) to avoid installing those development dependencies.