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