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