2025-04-10 14:36:22 -07:00
.TH "NPM-UNINSTALL" "1" "April 2025" "NPM@11.3.0" ""
2011-11-26 09:21:03 -08:00
.SH "NAME"
2022-12-06 22:18:33 -05:00
\fB npm-uninstall\fR - Remove a package
.SS "Synopsis"
2014-09-24 14:41:07 -07:00
.P
.RS 2
2014-11-04 15:08:12 -08:00
.nf
2022-12-06 22:18:33 -05:00
npm uninstall \[ lB]<@scope>/\[ rB]<pkg>...
2015-10-09 23:13:57 -07:00
2022-03-31 22:43:17 +00:00
aliases: unlink, remove, rm, r, un
2014-11-04 15:08:12 -08:00
.fi
2014-09-24 14:41:07 -07:00
.RE
2022-12-06 22:18:33 -05:00
.SS "Description"
2014-09-24 14:41:07 -07:00
.P
2022-12-06 22:18:33 -05:00
This uninstalls a package, completely removing everything npm installed on its behalf.
2014-03-19 09:25:40 -07:00
.P
2022-12-06 22:18:33 -05:00
It also removes the package from the \fB dependencies\fR , \fB devDependencies\fR , \fB optionalDependencies\fR , and \fB peerDependencies\fR objects in your \fB package.json\fR .
2014-09-24 14:41:07 -07:00
.P
2022-12-06 22:18:33 -05:00
Further, if you have an \fB npm-shrinkwrap.json\fR or \fB package-lock.json\fR , npm will update those files as well.
2014-03-19 09:25:40 -07:00
.P
2022-12-06 22:18:33 -05:00
\fB --no-save\fR will tell npm not to remove the package from your \fB package.json\fR , \fB npm-shrinkwrap.json\fR , or \fB package-lock.json\fR files.
2014-03-19 09:25:40 -07:00
.P
2022-12-06 22:18:33 -05:00
\fB --save\fR or \fB -S\fR will tell npm to remove the package from your \fB package.json\fR , \fB npm-shrinkwrap.json\fR , and \fB package-lock.json\fR files. This is the default, but you may need to use this if you have for instance \fB save=false\fR in your \fB npmrc\fR file
2014-09-24 14:41:07 -07:00
.P
2022-12-06 22:18:33 -05:00
In global mode (ie, with \fB -g\fR or \fB --global\fR appended to the command), it uninstalls the current package context as a global package. \fB --no-save\fR is ignored in this case.
2015-10-09 23:13:57 -07:00
.P
2022-12-06 22:18:33 -05:00
Scope is optional and follows the usual rules for npm help scope.
.SS "Examples"
2014-03-19 09:25:40 -07:00
.P
2021-01-15 16:09:24 -05:00
.RS 2
.nf
npm uninstall sax
.fi
.RE
.P
2022-12-06 22:18:33 -05:00
\fB sax\fR will no longer be in your \fB package.json\fR , \fB npm-shrinkwrap.json\fR , or \fB package-lock.json\fR files.
2014-09-24 14:41:07 -07:00
.P
.RS 2
2014-11-04 15:08:12 -08:00
.nf
2022-12-06 22:18:33 -05:00
npm uninstall lodash --no-save
2014-11-04 15:08:12 -08:00
.fi
2014-09-24 14:41:07 -07:00
.RE
2021-01-15 16:09:24 -05:00
.P
2022-12-06 22:18:33 -05:00
\fB lodash\fR will not be removed from your \fB package.json\fR , \fB npm-shrinkwrap.json\fR , or \fB package-lock.json\fR files.
.SS "Configuration"
.SS "\fBsave\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
Default: \fB true\fR unless when using \fB npm update\fR where it defaults to \fB false\fR
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
Save installed packages to a \fB package.json\fR file as dependencies.
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
When used with the \fB npm rm\fR command, removes the dependency from \fB package.json\fR .
2022-02-24 21:41:49 +00:00
.P
2022-12-06 22:18:33 -05:00
Will also prevent writing to \fB package-lock.json\fR if set to \fB false\fR .
2023-06-08 05:24:49 -07:00
.SS "\fBglobal\fR"
.RS 0
.IP \(bu 4
Default: false
.IP \(bu 4
Type: Boolean
.RE 0
.P
Operates in "global" mode, so that packages are installed into the \fB prefix\fR folder instead of the current working directory. See npm help folders for more on the differences in behavior.
.RS 0
.IP \(bu 4
packages are installed into the \fB {prefix}/lib/node_modules\fR folder, instead of the current working directory.
.IP \(bu 4
bin files are linked to \fB {prefix}/bin\fR
.IP \(bu 4
man pages are linked to \fB {prefix}/share/man\fR
.RE 0
2022-12-06 22:18:33 -05:00
.SS "\fBworkspace\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Default:
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Type: String (can be set multiple times)
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
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.
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
Valid values for the \fB workspace\fR config are either:
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Workspace names
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-05-20 15:54:50 -04:00
Path to a workspace directory
2022-12-06 22:18:33 -05:00
.IP \(bu 4
Path to a parent workspace directory (will result in selecting all workspaces within that folder)
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
When set for the \fB npm init\fR 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.
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
This value is not exported to the environment for child processes.
.SS "\fBworkspaces\fR"
2021-05-20 15:54:50 -04:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-10-14 22:17:47 +00:00
Default: null
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-10-14 22:17:47 +00:00
Type: null or Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
Set to true to run the command in the context of \fB all\fR configured workspaces.
2021-05-20 15:54:50 -04:00
.P
2022-12-06 22:18:33 -05:00
Explicitly setting this to false will cause commands like \fB install\fR to ignore workspaces altogether. When not set explicitly:
2021-10-14 22:17:47 +00:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
Commands that operate on the \fB node_modules\fR tree (install, update, etc.) will link workspaces into the \fB node_modules\fR folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, \fI unless\fR one or more workspaces are specified in the \fB workspace\fR config.
.RE 0
2021-10-14 22:17:47 +00:00
.P
2022-12-06 22:18:33 -05:00
This value is not exported to the environment for child processes.
.SS "\fBinclude-workspace-root\fR"
2021-10-14 22:17:47 +00:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-10-14 22:17:47 +00:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2021-10-14 22:17:47 +00:00
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2021-10-14 22:17:47 +00:00
.P
2022-12-06 22:18:33 -05:00
Include the workspace root when workspaces are enabled for a command.
2021-10-14 22:17:47 +00:00
.P
2022-12-06 22:18:33 -05:00
When false, specifying individual workspaces via the \fB workspace\fR config, or all workspaces via the \fB workspaces\fR flag, will cause npm to operate only on the specified workspaces, and not on the root project.
2022-04-14 21:57:02 +00:00
.P
2022-12-06 22:18:33 -05:00
This value is not exported to the environment for child processes.
.SS "\fBinstall-links\fR"
2022-04-28 18:41:15 +05:30
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2023-02-18 17:09:39 -05:00
Default: false
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2022-04-28 18:41:15 +05:30
Type: Boolean
2022-12-06 22:18:33 -05:00
.RE 0
2022-04-28 18:41:15 +05:30
.P
2022-12-06 22:18:33 -05:00
When set file: protocol dependencies will be packed and installed as regular dependencies instead of creating a symlink. This option has no effect on workspaces.
.SS "See Also"
2014-09-24 14:41:07 -07:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help prune
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help install
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-05 14:55:08 -05:00
npm help folders
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help config
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-05 14:55:08 -05:00
npm help npmrc
2022-12-06 22:18:33 -05:00
.RE 0