61

I've searched through the web and still can't get if there is any difference between npm add <package> and npm install --save <package>.

Thanks.

syntax-punk
  • 3,736
  • 3
  • 25
  • 33

2 Answers2

90

npm install and add are aliases. The --save option is deprecated.

Since NPM 5, packages are saved automatically; there is no --save option.

SamVK
  • 3,077
  • 1
  • 14
  • 19
10

add is just an alias for install.

So the only difference is --save, which modifies package.json with the dependancy.

$  npm add --help

npm install (with no args, in package dir)
npm install [<@scope>/]<pkg>
npm install [<@scope>/]<pkg>@<tag>
npm install [<@scope>/]<pkg>@<version>
npm install [<@scope>/]<pkg>@<version range>
npm install <folder>
npm install <tarball file>
npm install <tarball url>
npm install <git:// url>
npm install <github username>/<github project>

aliases: i, isntall, add
common options: [--save-prod|--save-dev|--save-optional] [--save-exact] [--no-save]
Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • 2
    I used to think the same way. But as I see the dependencies (package.json) are being updated as you run `npm add ...`. – syntax-punk Jul 22 '18 at 15:55