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 in devDependencies.
  • --save-prod: This saves the package in dependencies. This is the default.
  • --save-optional: This saves the package in optionalDependencies.

This feature is useful while installing different versions or different packages for different environments.

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources