1 ---
2 title: npm-uninstall
3 section: 1
4 description: Remove a package
5 github_repo: npm/cli
6 github_branch: release/v8
7 github_path: docs/lib/content/commands/npm-uninstall.md
8 redirect_from:
9 - /cli-documentation/v8/cli-commands/npm-uninstall
10 - /cli-documentation/v8/cli-commands/uninstall
11 - /cli-documentation/v8/commands/npm-uninstall
12 - /cli-documentation/v8/commands/uninstall
13 - /cli-documentation/v8/npm-uninstall
14 - /cli-documentation/v8/uninstall
15 - /cli/v8/cli-commands/npm-uninstall
16 - /cli/v8/cli-commands/uninstall
17 - /cli/v8/commands/uninstall
18 - /cli/v8/npm-uninstall
19 - /cli/v8/uninstall
20 ---
21
22 ### Synopsis
23
24 ```bash
25 npm uninstall [<@scope>/]<pkg>...
26
27 aliases: unlink, remove, rm, r, un
28 ```
29
30 ### Description
31
32 This uninstalls a package, completely removing everything npm installed on its behalf.
33
34 It also removes the package from the `dependencies`, `devDependencies`, `optionalDependencies`, and `peerDependencies` objects in your `package.json`.
35
36 Further, if you have an `npm-shrinkwrap.json` or `package-lock.json`, npm will update those files as well.
37
38 `--no-save` will tell npm not to remove the package from your `package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files.
39
40 `--save` or `-S` will tell npm to remove the package from your `package.json`, `npm-shrinkwrap.json`, and `package-lock.json` files. This is the default, but you may need to use this if you have for instance `save=false` in your `npmrc` file
41
42 In global mode (ie, with `-g` or `--global` appended to the command), it uninstalls the current package context as a global package. `--no-save` is ignored in this case.
43
44 Scope is optional and follows the usual rules for [`scope`](/cli/v8/using-npm/scope).
45
46 ### Examples
47
48 ```bash
49 npm uninstall sax
50 ```
51
52 `sax` will no longer be in your `package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files.
53
54 ```bash
55 npm uninstall lodash --no-save
56 ```
57
58 `lodash` will not be removed from your `package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files.
59
60 ### Configuration
61
62 #### `save`
63
64 - Default: `true` unless when using `npm update` where it defaults to `false`
65 - Type: Boolean
66
67 Save installed packages to a `package.json` file as dependencies.
68
69 When used with the `npm rm` command, removes the dependency from `package.json`.
70
71 Will also prevent writing to `package-lock.json` if set to `false`.
72
73 #### `workspace`
74
75 - Default:
76 - Type: String (can be set multiple times)
77
78 Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.
79
80 Valid values for the `workspace` config are either:
81
82 - Workspace names
83 - Path to a workspace directory
84 - Path to a parent workspace directory (will result in selecting all workspaces within that folder)
85
86 When set for the `npm init` command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
87
88 This value is not exported to the environment for child processes.
89
90 #### `workspaces`
91
92 - Default: null
93 - Type: null or Boolean
94
95 Set to true to run the command in the context of **all** configured workspaces.
96
97 Explicitly setting this to false will cause commands like `install` to ignore workspaces altogether. When not set explicitly:
98
99 - Commands that operate on the `node_modules` tree (install, update, etc.) will link workspaces into the `node_modules` folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, _unless_ one or more workspaces are specified in the `workspace` config.
100
101 This value is not exported to the environment for child processes.
102
103 #### `include-workspace-root`
104
105 - Default: false
106 - Type: Boolean
107
108 Include the workspace root when workspaces are enabled for a command.
109
110 When false, specifying individual workspaces via the `workspace` config, or all workspaces via the `workspaces` flag, will cause npm to operate only on the specified workspaces, and not on the root project.
111
112 This value is not exported to the environment for child processes.
113
114 #### `install-links`
115
116 - Default: false
117 - Type: Boolean
118
119 When set file: protocol dependencies that exist outside of the project root will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces.
120
121 ### See Also
122
123 - [npm prune](/cli/v8/commands/npm-prune)
124 - [npm install](/cli/v8/commands/npm-install)
125 - [npm folders](/cli/v8/configuring-npm/folders)
126 - [npm config](/cli/v8/commands/npm-config)
127 - [npmrc](/cli/v8/configuring-npm/npmrc)