1 ---
2 title: npm-unpublish
3 section: 1
4 description: Remove a package from the registry
5 github_repo: npm/cli
6 github_branch: release/v7
7 github_path: docs/content/commands/npm-unpublish.md
8 redirect_from:
9 - /cli-documentation/v7/cli-commands/npm-unpublish
10 - /cli-documentation/v7/cli-commands/unpublish
11 - /cli-documentation/v7/commands/npm-unpublish
12 - /cli-documentation/v7/commands/unpublish
13 - /cli-documentation/v7/npm-unpublish
14 - /cli-documentation/v7/unpublish
15 - /cli/v7/cli-commands/npm-unpublish
16 - /cli/v7/cli-commands/unpublish
17 - /cli/v7/commands/unpublish
18 - /cli/v7/npm-unpublish
19 - /cli/v7/unpublish
20 ---
21
22 ### Synopsis
23
24 To learn more about how the npm registry treats unpublish, see our [https://docs.npmjs.com/policies/unpublish](unpublish policies)
25
26 #### Unpublishing a single version of a package
27
28 ```bash
29 npm unpublish [<@scope>/]<pkg>@<version>
30 ```
31
32 #### Unpublishing an entire package
33
34 ```bash
35 npm unpublish [<@scope>/]<pkg> --force
36 ```
37
38 ### Warning
39
40 Consider using the [`deprecate`](/cli/v7/commands/npm-deprecate) command instead, if your intent is to encourage users to upgrade, or if you no longer want to maintain a package.
41
42 ### Description
43
44 This removes a package version from the registry, deleting its entry and removing the tarball.
45
46 The npm registry will return an error if you are not [logged in](/cli/v7/commands/npm-adduser).
47
48 If you do not specify a version or if you remove all of a package's versions then the registry will remove the root package entry entirely.
49
50 Even if you unpublish a package version, that specific name and version combination can never be reused. In order to publish the package again, you must use a new version number. If you unpublish the entire package, you may not publish any new versions of that package until 24 hours have passed.
51
52 ### Configuration
53
54 #### `dry-run`
55
56 - Default: false
57 - Type: Boolean
58
59 Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, `install`, `update`, `dedupe`, `uninstall`, as well as `pack` and `publish`.
60
61 Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc.
62
63 #### `force`
64
65 - Default: false
66 - Type: Boolean
67
68 Removes various protections against unfortunate side effects, common mistakes, unnecessary performance degradation, and malicious input.
69
70 - Allow clobbering non-npm files in global installs.
71 - Allow the `npm version` command to work on an unclean git repository.
72 - Allow deleting the cache folder with `npm cache clean`.
73 - Allow installing packages that have an `engines` declaration requiring a different version of npm.
74 - Allow installing packages that have an `engines` declaration requiring a different version of `node`, even if `--engine-strict` is enabled.
75 - Allow `npm audit fix` to install modules outside your stated dependency range (including SemVer-major changes).
76 - Allow unpublishing all versions of a published package.
77 - Allow conflicting peerDependencies to be installed in the root project.
78 - Implicitly set `--yes` during `npm init`.
79 - Allow clobbering existing values in `npm pkg`
80
81 If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option!
82
83 #### `workspace`
84
85 - Default:
86 - Type: String (can be set multiple times)
87
88 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.
89
90 Valid 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 to selecting all of the nested workspaces)
95
96 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.
97
98 This value is not exported to the environment for child processes.
99
100 #### `workspaces`
101
102 - Default: false
103 - Type: Boolean
104
105 Enable running a command in the context of **all** the configured workspaces.
106
107 This value is not exported to the environment for child processes.
108
109 ### See Also
110
111 - [npm deprecate](/cli/v7/commands/npm-deprecate)
112 - [npm publish](/cli/v7/commands/npm-publish)
113 - [npm registry](/cli/v7/using-npm/registry)
114 - [npm adduser](/cli/v7/commands/npm-adduser)
115 - [npm owner](/cli/v7/commands/npm-owner)
116 - [npm login](/cli/v7/commands/npm-adduser)