NPM install configurations

  1. Install package without updating package.json
npm install <package name> --no-save
  1. Install package and update dependencies in package.json (default)
npm install <package name> --save
  1. Install package and update devDependencies in package.json
npm install <package name> --save-dev
  1. Install package and update optionalDependencies in package.json
npm install <package name> --save-optional

Note

Dev dependencies are packages needed by the project in the dev environment and not in the production environment


Refs

  1. https://stackoverflow.com/questions/36022926/what-do-the-save-flags-do-with-npm-install
  2. https://www.geeksforgeeks.org/difference-between-dependencies-devdependencies-and-peerdependencies/