Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference betweeen npm install and npm install --save? [duplicate]

Tags:

node.js

npm

Including of the word --save means? or What is the Difference betweeen:

npm install and npm install --save?

like image 697
HamzaAhmed Avatar asked Jan 26 '18 11:01

HamzaAhmed


People also ask

What is the difference between npm install and npm install -- 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. 0 onwards. Before npm 5.0. 0, it was necessary to add --save after package name because it will save the installed package to package.

What is the difference between npm save and save dev?

--save saves the name and version of the package being installed in the dependency object. --save-dev saves the name and version of the package being installed in the dev-dependency object.

What is the difference between -- save and -- save dev flags while installing packages using npm?

There is no noticable difference between --save and --save-dev when developing. To take the moment. js example: when running webpack, the moment code is taken from node_modules and included in the project. In this sense there is no difference with typescript which is also needed when running webpack.

Is there a difference between npm install and npm I?

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.


1 Answers

Base on the npm documentations:

For older versions of NPM:

The npm install <package_name> command just downloads the specified package from NPM cloud, and saves it in node_modules directory in your current directory.

The npm install <package_name> --save command downloads the specified package from NPM cloud, and saves it in node_modules directory in your current directory, and also it adds the installed package into dependencies section of your package.json file.

For NPM versions > 5, there is no difference between these two commands. That is, the first command without --save option downloads the package and adds it into dependencies section of package.json file.

like image 135
Pezhman Parsaee Avatar answered Sep 18 '22 20:09

Pezhman Parsaee