1 ---
2 title: npm-unpublish
3 section: 1
4 description: Remove a package from the registry
5 github_repo: npm/cli
6 github_branch: latest
7 github_path: docs/lib/content/commands/npm-unpublish.md
8 redirect_from:
9 - /cli-commands/npm-unpublish
10 - /cli-commands/unpublish
11 - /cli-documentation/cli-commands/npm-unpublish
12 - /cli-documentation/cli-commands/unpublish
13 - /cli-documentation/commands/npm-unpublish
14 - /cli-documentation/commands/unpublish
15 - /cli-documentation/npm-unpublish
16 - /cli-documentation/unpublish
17 - /cli-documentation/v11/cli-commands/npm-unpublish
18 - /cli-documentation/v11/cli-commands/unpublish
19 - /cli-documentation/v11/commands/npm-unpublish
20 - /cli-documentation/v11/commands/unpublish
21 - /cli-documentation/v11/npm-unpublish
22 - /cli-documentation/v11/unpublish
23 - /cli/cli-commands/npm-unpublish
24 - /cli/cli-commands/unpublish
25 - /cli/commands/npm-unpublish
26 - /cli/commands/unpublish
27 - /cli/npm-unpublish
28 - /cli/unpublish
29 - /cli/v11/cli-commands/npm-unpublish
30 - /cli/v11/cli-commands/unpublish
31 - /cli/v11/commands/unpublish
32 - /cli/v11/npm-unpublish
33 - /cli/v11/unpublish
34 - /commands/npm-unpublish
35 - /commands/unpublish
36 ---
37
38 ### Synopsis
39
40 ```bash
41 npm unpublish [<package-spec>]
42 ```
43
44 To learn more about how the npm registry treats unpublish, see our [unpublish policies](https://docs.npmjs.com/policies/unpublish).
45
46 ### Warning
47
48 Consider using the [`deprecate`](/cli/v11/commands/npm-deprecate) command instead, if your intent is to encourage users to upgrade, or if you no longer want to maintain a package.
49
50 ### Description
51
52 This removes a package version from the registry, deleting its entry and removing the tarball.
53
54 The npm registry will return an error if you are not [logged in](/cli/v11/commands/npm-adduser).
55
56 If you do not specify a package name at all, the name and version to be unpublished will be pulled from the project in the current directory.
57
58 If you specify a package name but 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.
59
60 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.
61
62 ### Configuration
63
64 #### `dry-run`
65
66 - Default: false
67 - Type: Boolean
68
69 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`.
70
71 Note: This is NOT honored by other network related commands, eg `dist-tags`, `owner`, etc.
72
73 #### `force`
74
75 - Default: false
76 - Type: Boolean
77
78 Removes various protections against unfortunate side effects, common mistakes, unnecessary performance degradation, and malicious input.
79
80 - Allow clobbering non-npm files in global installs.
81 - Allow the `npm version` command to work on an unclean git repository.
82 - Allow deleting the cache folder with `npm cache clean`.
83 - Allow installing packages that have an `engines` declaration requiring a different version of npm.
84 - Allow installing packages that have an `engines` declaration requiring a different version of `node`, even if `--engine-strict` is enabled.
85 - Allow `npm audit fix` to install modules outside your stated dependency range (including SemVer-major changes).
86 - Allow unpublishing all versions of a published package.
87 - Allow conflicting peerDependencies to be installed in the root project.
88 - Implicitly set `--yes` during `npm init`.
89 - Allow clobbering existing values in `npm pkg`
90 - Allow unpublishing of entire packages (not just a single version).
91
92 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!
93
94 #### `workspace`
95
96 - Default:
97 - Type: String (can be set multiple times)
98
99 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.
100
101 Valid values for the `workspace` config are either:
102
103 - Workspace names
104 - Path to a workspace directory
105 - Path to a parent workspace directory (will result in selecting all workspaces within that folder)
106
107 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.
108
109 This value is not exported to the environment for child processes.
110
111 #### `workspaces`
112
113 - Default: null
114 - Type: null or Boolean
115
116 Set to true to run the command in the context of **all** configured workspaces.
117
118 Explicitly setting this to false will cause commands like `install` to ignore workspaces altogether. When not set explicitly:
119
120 - Commands that operate on the `node_modules` tree (install, update, etc.) will link workspaces into the `node_modules` folder. - Commands that do other things (test, exec, publish, etc.) will operate on the root project, _unless_ one or more workspaces are specified in the `workspace` config.
121
122 This value is not exported to the environment for child processes.
123
124 ### See Also
125
126 - [package spec](/cli/v11/using-npm/package-spec)
127 - [npm deprecate](/cli/v11/commands/npm-deprecate)
128 - [npm publish](/cli/v11/commands/npm-publish)
129 - [npm registry](/cli/v11/using-npm/registry)
130 - [npm adduser](/cli/v11/commands/npm-adduser)
131 - [npm owner](/cli/v11/commands/npm-owner)
132 - [npm login](/cli/v11/commands/npm-adduser)