What is npm install --save?
Overview
NPM stands for node package manager. It is a package manager for node, written in Javascript.
We can install any required packages with the npm command, using the below syntax:
npm install packagename
Where packagename is the package name of the required npm package that we want to download.
--save
NPM provides the --save option while installing the packages. If we use the --save option after installing the package, it will be saved in package.json inside dependencies.
Syntax
npm install gulp --save
We have other options, such as:
--save-dev: This saves the package indevDependencies.--save-prod: This saves the package in dependencies. This is the default.--save-optional: This saves the package inoptionalDependencies.
This feature is useful while installing different versions or different packages for different environments.