Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does npm install -d --save mean

Tags:

node.js

npm

I have recently come across one of these statements in a node project that I am currently working on that we use to install node modules locally

npm install -d --save

Can somebody please tell me what it means as earlier we used to use simply npm install

I want to know the difference between the two

like image 568
Nav Avatar asked Mar 06 '14 19:03

Nav


2 Answers

From http://npmjs.org/doc/misc/npm-config.html:

The following shorthands are parsed on the command-line: -d: --loglevel info

From https://www.npmjs.org/doc/install.html

--save: Package will appear in your dependencies.

like image 199
Steve Jansen Avatar answered Oct 18 '22 19:10

Steve Jansen


It adds it to your dependencies in your packages.json

For example, I just did

npm install async --save

It added this to my packages.json

"dependencies": {
  "async": "~0.2.10",

Before you do that however, make sure you create your packages.json by running

npm init

By adding packages to source control (but not the node_modules it lays down locally), when others consume your solution, when they do 'npm install' after pulling your solution, it will pull those dependencies - you don't have to distribute.

https://www.npmjs.org/doc/cli/npm-install.html

like image 20
bryanmac Avatar answered Oct 18 '22 20:10

bryanmac