Nav
Nav

Reputation: 10442

what does npm install -d --save mean

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

Upvotes: 9

Views: 14599

Answers (2)

bryanmac
bryanmac

Reputation: 39306

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

Upvotes: 5

Steve Jansen
Steve Jansen

Reputation: 9492

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.

Upvotes: 8

Related Questions