Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is npm install the same as npm install --save? [duplicate]

Tags:

I'm looking at the doc page for node and I'm not clear if

npm install gulp-util 

is the same as

npm install gulp-util --save 

In the doc it says:

"By default, npm install will install all modules listed as dependencies in package.json"

That feels like what --save does,

https://docs.npmjs.com/cli/install

like image 745
Peter Kellner Avatar asked Feb 19 '16 19:02

Peter Kellner


People also ask

What is the difference between npm install and npm install -- save?

It has a very frequently used command npm install [Package Name] –save. But the fact is there is no difference between npm install [Package Name] and npm install [Package Name] –save in the later version after npm 5.0.

Is npm install -- Save necessary?

As of npm 5.0. 0, installed modules are added as a dependency by default, so the --save option is no longer needed.

Is npm I the same as npm install?

There is no difference, since "npm i" is an alias for "npm install". They both do the exact same thing (install or update all the dependencies in your package-lock.

What npm install install?

The npm install installs all modules that are listed on package. json file and their dependencies. npm update updates all packages in the node_modules directory and their dependencies.


1 Answers

Just running npm install with no arguments, will install everything listed in the dependencies area of the package.json file.

Running npm install <package-name> will install that package only, and will not add the package to the dependencies list in package.json

Running npm install <package-name> --save will install that package only, and will add the package to the dependencies list.

Update for npm 5+:

Running npm install <package-name> will install that package, and will add the package to the dependencies list.

like image 194
mikefrey Avatar answered Sep 29 '22 10:09

mikefrey