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 |
21 | `npm version 1.2.3` | Bump the package version to 1.2.3 |
22 | `npm version major` | Bump the major package version by 1 (1.2.3 → 2.0.0) |
23 | `npm version minor` | Bump the minor package version by 1 (1.2.3 → 1.3.0) |
24 | `npm version patch` | Bump the patch package version by 1 (1.2.3 → 1.2.4) |
27 `--save` is the default as of npm@5. Previously, using `npm install` without `--save` doesn't update package.json.
31 | Command | Description |
33 | `npm i sax` | NPM package |
34 | `npm i sax@latest` | Specify tag `latest` |
35 | `npm i sax@3.0.0` | Specify version `3.0.0` |
36 | `npm i sax@">=1 <2.0"` | Specify version range |
38 | `npm i @org/sax` | Scoped NPM package |
40 | `npm i user/repo` | GitHub |
41 | `npm i user/repo#master` | GitHub |
42 | `npm i github:user/repo` | GitHub |
43 | `npm i gitlab:user/repo` | GitLab |
45 | `npm i /path/to/repo` | Absolute path |
46 | `npm i ./archive.tgz` | Tarball |
47 | `npm i https://site.com/archive.tgz` | Tarball via HTTP |
51 | Command | Description |
53 | `npm list` | Lists the installed versions of all dependencies in this software |
54 | `npm list -g --depth 0` | Lists the installed versions of all globally installed packages |
55 | `npm view` | Lists the latest versions of all dependencies in this software |
56 | `npm outdated` | Lists only the dependencies in this software which are outdated |
60 | Command | Description |
62 | `npm update` | Update production packages |
63 | `npm update --dev` | Update dev packages |
64 | `npm update -g` | Update global packages |
66 | `npm update lodash` | Update a package |
71 | Command | Description |
73 | `npm rm lodash` | Remove package production packages |
78 # Add someone as an owner
79 npm owner add USERNAME PACKAGENAME
88 # Adds warning to those that install a package of old versions
89 npm deprecate PACKAGE@"< 0.2.0" "critical bug fixed in v0.2.0"
93 # update all packages, or selected packages
94 npm update [-g] PACKAGE
98 # Check for outdated packages
99 npm outdated [PACKAGE]