Skip to content

Commit 1135539

Browse files
committedJan 14, 2021
fix(docs): clean up npm uninstall docs
Lots of flags removed, clarification on what `--no-save` does, consolidated examples into a separate section
1 parent 4b43656 commit 1135539

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed
 

‎docs/content/commands/npm-uninstall.md

+21-22
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: Remove a package
77
### Synopsis
88

99
```bash
10-
npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|-D|--save-dev|-O|--save-optional|--no-save]
10+
npm uninstall [<@scope>/]<pkg>[@<version>]... [--no-save]
1111

1212
aliases: remove, rm, r, un, unlink
1313
```
@@ -17,40 +17,39 @@ aliases: remove, rm, r, un, unlink
1717
This uninstalls a package, completely removing everything npm installed
1818
on its behalf.
1919

20-
Example:
20+
It also removes the package from the `dependencies`, `devDependencies`,
21+
`optionalDependencies`, and `peerDependencies` objects in your
22+
`package.json`.
2123

22-
```bash
23-
npm uninstall sax
24-
```
24+
Futher, if you have an `npm-shrinkwrap.json` or `package-lock.json`, npm
25+
will update those files as well.
26+
27+
`npm uninstall` takes one optional flag, `--no-save` which will tell npm
28+
not to remove the package from your `package.json`,
29+
`npm-shrinkwrap.json`, or `package-lock.json` files
2530

2631
In global mode (ie, with `-g` or `--global` appended to the command),
2732
it uninstalls the current package context as a global package.
33+
`--no-save` is ignored in this case.
2834

29-
`npm uninstall` takes 3 exclusive, optional flags which save or update
30-
the package version in your main package.json:
31-
32-
* `-S, --save`: Package will be removed from your `dependencies`.
33-
34-
* `-D, --save-dev`: Package will be removed from your `devDependencies`.
35-
36-
* `-O, --save-optional`: Package will be removed from your `optionalDependencies`.
35+
Scope is optional and follows the usual rules for [`scope`](/using-npm/scope).
3736

38-
* `--no-save`: Package will not be removed from your `package.json` file.
37+
### Examples
3938

40-
Further, if you have an `npm-shrinkwrap.json` then it will be updated as
41-
well.
39+
```bash
40+
npm uninstall sax
41+
```
4242

43-
Scope is optional and follows the usual rules for [`scope`](/using-npm/scope).
43+
sax will no longer be in your `package.json`, `npm-shrinkwrap.json`, or
44+
`package-lock.json` files.
4445

45-
Examples:
4646
```bash
47-
npm uninstall sax --save
48-
npm uninstall @myorg/privatepackage --save
49-
npm uninstall node-tap --save-dev
50-
npm uninstall dtrace-provider --save-optional
5147
npm uninstall lodash --no-save
5248
```
5349

50+
lodash will not be removed fromy your `package.json`,
51+
`npm-shrinkwrap.json`, or `package-lock.json` files.
52+
5453
### See Also
5554

5655
* [npm prune](/commands/npm-prune)

0 commit comments

Comments
 (0)
Please sign in to comment.