Team Ai
Datasetpublic

codekingpro/portable-devtools

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