1.npm install
Modules in dependencies and devDependencies will be downloaded, and only modules in dependencies will be downloaded when using npm install –production or indicating that the NODE_ENV variable value is production.
npm install individual modules: Installed into node_modules directory, but not saved in package.json. When you run the npm install command afterwards, the module will not be installed automatically.
2.npm install --save
Install it in the node_modules directory, save it in the dependencies field in the package.json, and install the modules that depend on the production environment, that is, the modules that are run at the time of the project, such as react, react-dom, jQuery, etc. These modules will be automatically installed into the node_modules when you run npm install, or npm install --production, or indicate that the NODE_ENV variable value is production.
3.npm install --save-dev
Install it in the node_modules directory, save it in the devDependencies field in the package.json, and install the modules that the development environment depends, that is, the modules during project development, such as babel (transcoder, which can convert ES6 code to ES5 code) and other tools, only need to be used in the development environment. Running npm install will automatically install these modules into the node_modules node_modules, but not when running npm install --production or when the NODE_ENV variable value is production. |