11cb0ef41Sopenharmony_ci---
21cb0ef41Sopenharmony_cititle: npm-uninstall
31cb0ef41Sopenharmony_cisection: 1
41cb0ef41Sopenharmony_cidescription: Remove a package
51cb0ef41Sopenharmony_ci---
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci### Synopsis
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci```bash
101cb0ef41Sopenharmony_cinpm uninstall [<@scope>/]<pkg>...
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_cialiases: unlink, remove, rm, r, un
131cb0ef41Sopenharmony_ci```
141cb0ef41Sopenharmony_ci
151cb0ef41Sopenharmony_ci### Description
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciThis uninstalls a package, completely removing everything npm installed
181cb0ef41Sopenharmony_cion its behalf.
191cb0ef41Sopenharmony_ci
201cb0ef41Sopenharmony_ciIt also removes the package from the `dependencies`, `devDependencies`,
211cb0ef41Sopenharmony_ci`optionalDependencies`, and `peerDependencies` objects in your
221cb0ef41Sopenharmony_ci`package.json`.
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ciFurther, if you have an `npm-shrinkwrap.json` or `package-lock.json`, npm
251cb0ef41Sopenharmony_ciwill update those files as well.
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ci`--no-save` will tell npm not to remove the package from your
281cb0ef41Sopenharmony_ci`package.json`, `npm-shrinkwrap.json`, or `package-lock.json` files.
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ci`--save` or `-S` will tell npm to remove the package from your
311cb0ef41Sopenharmony_ci`package.json`, `npm-shrinkwrap.json`, and `package-lock.json` files.
321cb0ef41Sopenharmony_ciThis is the default, but you may need to use this if you have for
331cb0ef41Sopenharmony_ciinstance `save=false` in your `npmrc` file
341cb0ef41Sopenharmony_ci
351cb0ef41Sopenharmony_ciIn global mode (ie, with `-g` or `--global` appended to the command),
361cb0ef41Sopenharmony_ciit uninstalls the current package context as a global package.
371cb0ef41Sopenharmony_ci`--no-save` is ignored in this case.
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ciScope is optional and follows the usual rules for [`scope`](/using-npm/scope).
401cb0ef41Sopenharmony_ci
411cb0ef41Sopenharmony_ci### Examples
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ci```bash
441cb0ef41Sopenharmony_cinpm uninstall sax
451cb0ef41Sopenharmony_ci```
461cb0ef41Sopenharmony_ci
471cb0ef41Sopenharmony_ci`sax` will no longer be in your `package.json`, `npm-shrinkwrap.json`, or
481cb0ef41Sopenharmony_ci`package-lock.json` files.
491cb0ef41Sopenharmony_ci
501cb0ef41Sopenharmony_ci```bash
511cb0ef41Sopenharmony_cinpm uninstall lodash --no-save
521cb0ef41Sopenharmony_ci```
531cb0ef41Sopenharmony_ci
541cb0ef41Sopenharmony_ci`lodash` will not be removed from your `package.json`,
551cb0ef41Sopenharmony_ci`npm-shrinkwrap.json`, or `package-lock.json` files.
561cb0ef41Sopenharmony_ci
571cb0ef41Sopenharmony_ci### Configuration
581cb0ef41Sopenharmony_ci
591cb0ef41Sopenharmony_ci#### `save`
601cb0ef41Sopenharmony_ci
611cb0ef41Sopenharmony_ci* Default: `true` unless when using `npm update` where it defaults to `false`
621cb0ef41Sopenharmony_ci* Type: Boolean
631cb0ef41Sopenharmony_ci
641cb0ef41Sopenharmony_ciSave installed packages to a `package.json` file as dependencies.
651cb0ef41Sopenharmony_ci
661cb0ef41Sopenharmony_ciWhen used with the `npm rm` command, removes the dependency from
671cb0ef41Sopenharmony_ci`package.json`.
681cb0ef41Sopenharmony_ci
691cb0ef41Sopenharmony_ciWill also prevent writing to `package-lock.json` if set to `false`.
701cb0ef41Sopenharmony_ci
711cb0ef41Sopenharmony_ci
721cb0ef41Sopenharmony_ci
731cb0ef41Sopenharmony_ci#### `global`
741cb0ef41Sopenharmony_ci
751cb0ef41Sopenharmony_ci* Default: false
761cb0ef41Sopenharmony_ci* Type: Boolean
771cb0ef41Sopenharmony_ci
781cb0ef41Sopenharmony_ciOperates in "global" mode, so that packages are installed into the `prefix`
791cb0ef41Sopenharmony_cifolder instead of the current working directory. See
801cb0ef41Sopenharmony_ci[folders](/configuring-npm/folders) for more on the differences in behavior.
811cb0ef41Sopenharmony_ci
821cb0ef41Sopenharmony_ci* packages are installed into the `{prefix}/lib/node_modules` folder, instead
831cb0ef41Sopenharmony_ci  of the current working directory.
841cb0ef41Sopenharmony_ci* bin files are linked to `{prefix}/bin`
851cb0ef41Sopenharmony_ci* man pages are linked to `{prefix}/share/man`
861cb0ef41Sopenharmony_ci
871cb0ef41Sopenharmony_ci
881cb0ef41Sopenharmony_ci
891cb0ef41Sopenharmony_ci#### `workspace`
901cb0ef41Sopenharmony_ci
911cb0ef41Sopenharmony_ci* Default:
921cb0ef41Sopenharmony_ci* Type: String (can be set multiple times)
931cb0ef41Sopenharmony_ci
941cb0ef41Sopenharmony_ciEnable running a command in the context of the configured workspaces of the
951cb0ef41Sopenharmony_cicurrent project while filtering by running only the workspaces defined by
961cb0ef41Sopenharmony_cithis configuration option.
971cb0ef41Sopenharmony_ci
981cb0ef41Sopenharmony_ciValid values for the `workspace` config are either:
991cb0ef41Sopenharmony_ci
1001cb0ef41Sopenharmony_ci* Workspace names
1011cb0ef41Sopenharmony_ci* Path to a workspace directory
1021cb0ef41Sopenharmony_ci* Path to a parent workspace directory (will result in selecting all
1031cb0ef41Sopenharmony_ci  workspaces within that folder)
1041cb0ef41Sopenharmony_ci
1051cb0ef41Sopenharmony_ciWhen set for the `npm init` command, this may be set to the folder of a
1061cb0ef41Sopenharmony_ciworkspace which does not yet exist, to create the folder and set it up as a
1071cb0ef41Sopenharmony_cibrand new workspace within the project.
1081cb0ef41Sopenharmony_ci
1091cb0ef41Sopenharmony_ciThis value is not exported to the environment for child processes.
1101cb0ef41Sopenharmony_ci
1111cb0ef41Sopenharmony_ci#### `workspaces`
1121cb0ef41Sopenharmony_ci
1131cb0ef41Sopenharmony_ci* Default: null
1141cb0ef41Sopenharmony_ci* Type: null or Boolean
1151cb0ef41Sopenharmony_ci
1161cb0ef41Sopenharmony_ciSet to true to run the command in the context of **all** configured
1171cb0ef41Sopenharmony_ciworkspaces.
1181cb0ef41Sopenharmony_ci
1191cb0ef41Sopenharmony_ciExplicitly setting this to false will cause commands like `install` to
1201cb0ef41Sopenharmony_ciignore workspaces altogether. When not set explicitly:
1211cb0ef41Sopenharmony_ci
1221cb0ef41Sopenharmony_ci- Commands that operate on the `node_modules` tree (install, update, etc.)
1231cb0ef41Sopenharmony_ciwill link workspaces into the `node_modules` folder. - Commands that do
1241cb0ef41Sopenharmony_ciother things (test, exec, publish, etc.) will operate on the root project,
1251cb0ef41Sopenharmony_ci_unless_ one or more workspaces are specified in the `workspace` config.
1261cb0ef41Sopenharmony_ci
1271cb0ef41Sopenharmony_ciThis value is not exported to the environment for child processes.
1281cb0ef41Sopenharmony_ci
1291cb0ef41Sopenharmony_ci#### `include-workspace-root`
1301cb0ef41Sopenharmony_ci
1311cb0ef41Sopenharmony_ci* Default: false
1321cb0ef41Sopenharmony_ci* Type: Boolean
1331cb0ef41Sopenharmony_ci
1341cb0ef41Sopenharmony_ciInclude the workspace root when workspaces are enabled for a command.
1351cb0ef41Sopenharmony_ci
1361cb0ef41Sopenharmony_ciWhen false, specifying individual workspaces via the `workspace` config, or
1371cb0ef41Sopenharmony_ciall workspaces via the `workspaces` flag, will cause npm to operate only on
1381cb0ef41Sopenharmony_cithe specified workspaces, and not on the root project.
1391cb0ef41Sopenharmony_ci
1401cb0ef41Sopenharmony_ciThis value is not exported to the environment for child processes.
1411cb0ef41Sopenharmony_ci
1421cb0ef41Sopenharmony_ci#### `install-links`
1431cb0ef41Sopenharmony_ci
1441cb0ef41Sopenharmony_ci* Default: false
1451cb0ef41Sopenharmony_ci* Type: Boolean
1461cb0ef41Sopenharmony_ci
1471cb0ef41Sopenharmony_ciWhen set file: protocol dependencies will be packed and installed as regular
1481cb0ef41Sopenharmony_cidependencies instead of creating a symlink. This option has no effect on
1491cb0ef41Sopenharmony_ciworkspaces.
1501cb0ef41Sopenharmony_ci
1511cb0ef41Sopenharmony_ci
1521cb0ef41Sopenharmony_ci
1531cb0ef41Sopenharmony_ci### See Also
1541cb0ef41Sopenharmony_ci
1551cb0ef41Sopenharmony_ci* [npm prune](/commands/npm-prune)
1561cb0ef41Sopenharmony_ci* [npm install](/commands/npm-install)
1571cb0ef41Sopenharmony_ci* [npm folders](/configuring-npm/folders)
1581cb0ef41Sopenharmony_ci* [npm config](/commands/npm-config)
1591cb0ef41Sopenharmony_ci* [npmrc](/configuring-npm/npmrc)
160