11 | Command | Description |
13 | `npm i` | Alias for `npm install` |
14 | `npm install` | Install everything in package.json |
15 | `npm install --production` | Install everything in package.json, except devDependecies |
17 | `npm install lodash` | Install a package |
18 | `npm install --save-dev lodash` | Install as devDependency |
19 | `npm install --save-exact lodash` | Install with exact |
22 `--save` is the default as of npm@5. Previously, using `npm install` without `--save` doesn't update package.json.
26 | Command | Description |
28 | `npm i sax` | NPM package |
29 | `npm i sax@latest` | Specify tag `latest` |
30 | `npm i sax@3.0.0` | Specify version `3.0.0` |
31 | `npm i sax@">=1 <2.0"` | Specify version range |
33 | `npm i @org/sax` | Scoped NPM package |
35 | `npm i user/repo` | GitHub |
36 | `npm i user/repo#master` | GitHub |
37 | `npm i github:user/repo` | GitHub |
38 | `npm i gitlab:user/repo` | GitLab |
40 | `npm i /path/to/repo` | Absolute path |
41 | `npm i ./archive.tgz` | Tarball |
42 | `npm i https://site.com/archive.tgz` | Tarball via HTTP |
46 | Command | Description |
48 | `npm list` | Lists the installed versions of all dependencies in this software |
49 | `npm list -g --depth 0` | Lists the installed versions of all globally installed packages |
50 | `npm view` | Lists the latest versions of all dependencies in this software |
51 | `npm outdated` | Lists only the dependencies in this software which are outdated |
55 | Command | Description |
57 | `npm update` | Update production packages |
58 | `npm update --dev` | Update dev packages |
59 | `npm update -g` | Update global packages |
61 | `npm update lodash` | Update a package |
67 # Add someone as an owner
68 npm owner add USERNAME PACKAGENAME
77 # Adds warning to those that install a package of old versions
78 npm deprecate PACKAGE@"< 0.2.0" "critical bug fixed in v0.2.0"
82 # update all packages, or selected packages
83 npm update [-g] PACKAGE
87 # Check for outdated packages
88 npm outdated [PACKAGE]