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