patch-1
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-uninstall |
| 3 | section: 1 |
| 4 | description: Remove a package |
| 5 | github_repo: npm/cli |
| 6 | github_branch: release/v7 |
| 7 | github_path: docs/content/commands/npm-uninstall.md |
| 8 | redirect_from: |
| 9 | - /cli-documentation/v7/cli-commands/npm-uninstall |
| 10 | - /cli-documentation/v7/cli-commands/uninstall |
| 11 | - /cli-documentation/v7/commands/npm-uninstall |
| 12 | - /cli-documentation/v7/commands/uninstall |
| 13 | - /cli-documentation/v7/npm-uninstall |
| 14 | - /cli-documentation/v7/uninstall |
| 15 | - /cli/v7/cli-commands/npm-uninstall |
| 16 | - /cli/v7/cli-commands/uninstall |
| 17 | - /cli/v7/commands/uninstall |
| 18 | - /cli/v7/npm-uninstall |
| 19 | - /cli/v7/uninstall |
| 20 | --- |
| 21 | |
| 22 | ### Synopsis |
| 23 | |
| 24 | ```bash |
| 25 | npm uninstall [<@scope>/]<pkg>[@<version>]... [-S|--save|--no-save] |
| 26 | |
| 27 | aliases: remove, rm, r, un, unlink |
| 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 | Futher, 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/v7/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 |
| 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 | #### `workspace` |
| 72 | |
| 73 | - Default: |
| 74 | - Type: String (can be set multiple times) |
| 75 | |
| 76 | 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. |
| 77 | |
| 78 | Valid values for the `workspace` config are either: |
| 79 | |
| 80 | - Workspace names |
| 81 | - Path to a workspace directory |
| 82 | - Path to a parent workspace directory (will result to selecting all of the nested workspaces) |
| 83 | |
| 84 | 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. |
| 85 | |
| 86 | This value is not exported to the environment for child processes. |
| 87 | |
| 88 | #### `workspaces` |
| 89 | |
| 90 | - Default: false |
| 91 | - Type: Boolean |
| 92 | |
| 93 | Enable running a command in the context of **all** the configured workspaces. |
| 94 | |
| 95 | This value is not exported to the environment for child processes. |
| 96 | |
| 97 | ### See Also |
| 98 | |
| 99 | - [npm prune](/cli/v7/commands/npm-prune) |
| 100 | - [npm install](/cli/v7/commands/npm-install) |
| 101 | - [npm folders](/cli/v7/configuring-npm/folders) |
| 102 | - [npm config](/cli/v7/commands/npm-config) |
| 103 | - [npmrc](/cli/v7/configuring-npm/npmrc) |