11cb0ef41Sopenharmony_ci---
21cb0ef41Sopenharmony_cititle: npm-unpublish
31cb0ef41Sopenharmony_cisection: 1
41cb0ef41Sopenharmony_cidescription: Remove a package from the registry
51cb0ef41Sopenharmony_ci---
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci### Synopsis
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci```bash
101cb0ef41Sopenharmony_cinpm unpublish [<package-spec>]
111cb0ef41Sopenharmony_ci```
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_ciTo learn more about how the npm registry treats unpublish, see our
141cb0ef41Sopenharmony_ci[unpublish policies](https://docs.npmjs.com/policies/unpublish).
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci### Warning
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ciConsider using the [`deprecate`](/commands/npm-deprecate) command instead,
191cb0ef41Sopenharmony_ciif your intent is to encourage users to upgrade, or if you no longer
201cb0ef41Sopenharmony_ciwant to maintain a package.
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci### Description
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ciThis removes a package version from the registry, deleting its entry and
251cb0ef41Sopenharmony_ciremoving the tarball.
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ciThe npm registry will return an error if you are not [logged
281cb0ef41Sopenharmony_ciin](/commands/npm-adduser).
291cb0ef41Sopenharmony_ci
301cb0ef41Sopenharmony_ciIf you do not specify a package name at all, the name and version to be
311cb0ef41Sopenharmony_ciunpublished will be pulled from the project in the current directory.
321cb0ef41Sopenharmony_ci
331cb0ef41Sopenharmony_ciIf you specify a package name but do not specify a version or if you
341cb0ef41Sopenharmony_ciremove all of a package's versions then the registry will remove the
351cb0ef41Sopenharmony_ciroot package entry entirely.
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ciEven if you unpublish a package version, that specific name and version
381cb0ef41Sopenharmony_cicombination can never be reused. In order to publish the package again,
391cb0ef41Sopenharmony_ciyou must use a new version number. If you unpublish the entire package,
401cb0ef41Sopenharmony_ciyou may not publish any new versions of that package until 24 hours have
411cb0ef41Sopenharmony_cipassed.
421cb0ef41Sopenharmony_ci
431cb0ef41Sopenharmony_ci### Configuration
441cb0ef41Sopenharmony_ci
451cb0ef41Sopenharmony_ci#### `dry-run`
461cb0ef41Sopenharmony_ci
471cb0ef41Sopenharmony_ci* Default: false
481cb0ef41Sopenharmony_ci* Type: Boolean
491cb0ef41Sopenharmony_ci
501cb0ef41Sopenharmony_ciIndicates that you don't want npm to make any changes and that it should
511cb0ef41Sopenharmony_cionly report what it would have done. This can be passed into any of the
521cb0ef41Sopenharmony_cicommands that modify your local installation, eg, `install`, `update`,
531cb0ef41Sopenharmony_ci`dedupe`, `uninstall`, as well as `pack` and `publish`.
541cb0ef41Sopenharmony_ci
551cb0ef41Sopenharmony_ciNote: This is NOT honored by other network related commands, eg `dist-tags`,
561cb0ef41Sopenharmony_ci`owner`, etc.
571cb0ef41Sopenharmony_ci
581cb0ef41Sopenharmony_ci
591cb0ef41Sopenharmony_ci
601cb0ef41Sopenharmony_ci#### `force`
611cb0ef41Sopenharmony_ci
621cb0ef41Sopenharmony_ci* Default: false
631cb0ef41Sopenharmony_ci* Type: Boolean
641cb0ef41Sopenharmony_ci
651cb0ef41Sopenharmony_ciRemoves various protections against unfortunate side effects, common
661cb0ef41Sopenharmony_cimistakes, unnecessary performance degradation, and malicious input.
671cb0ef41Sopenharmony_ci
681cb0ef41Sopenharmony_ci* Allow clobbering non-npm files in global installs.
691cb0ef41Sopenharmony_ci* Allow the `npm version` command to work on an unclean git repository.
701cb0ef41Sopenharmony_ci* Allow deleting the cache folder with `npm cache clean`.
711cb0ef41Sopenharmony_ci* Allow installing packages that have an `engines` declaration requiring a
721cb0ef41Sopenharmony_ci  different version of npm.
731cb0ef41Sopenharmony_ci* Allow installing packages that have an `engines` declaration requiring a
741cb0ef41Sopenharmony_ci  different version of `node`, even if `--engine-strict` is enabled.
751cb0ef41Sopenharmony_ci* Allow `npm audit fix` to install modules outside your stated dependency
761cb0ef41Sopenharmony_ci  range (including SemVer-major changes).
771cb0ef41Sopenharmony_ci* Allow unpublishing all versions of a published package.
781cb0ef41Sopenharmony_ci* Allow conflicting peerDependencies to be installed in the root project.
791cb0ef41Sopenharmony_ci* Implicitly set `--yes` during `npm init`.
801cb0ef41Sopenharmony_ci* Allow clobbering existing values in `npm pkg`
811cb0ef41Sopenharmony_ci* Allow unpublishing of entire packages (not just a single version).
821cb0ef41Sopenharmony_ci
831cb0ef41Sopenharmony_ciIf you don't have a clear idea of what you want to do, it is strongly
841cb0ef41Sopenharmony_cirecommended that you do not use this option!
851cb0ef41Sopenharmony_ci
861cb0ef41Sopenharmony_ci
871cb0ef41Sopenharmony_ci
881cb0ef41Sopenharmony_ci#### `workspace`
891cb0ef41Sopenharmony_ci
901cb0ef41Sopenharmony_ci* Default:
911cb0ef41Sopenharmony_ci* Type: String (can be set multiple times)
921cb0ef41Sopenharmony_ci
931cb0ef41Sopenharmony_ciEnable running a command in the context of the configured workspaces of the
941cb0ef41Sopenharmony_cicurrent project while filtering by running only the workspaces defined by
951cb0ef41Sopenharmony_cithis configuration option.
961cb0ef41Sopenharmony_ci
971cb0ef41Sopenharmony_ciValid values for the `workspace` config are either:
981cb0ef41Sopenharmony_ci
991cb0ef41Sopenharmony_ci* Workspace names
1001cb0ef41Sopenharmony_ci* Path to a workspace directory
1011cb0ef41Sopenharmony_ci* Path to a parent workspace directory (will result in selecting all
1021cb0ef41Sopenharmony_ci  workspaces within that folder)
1031cb0ef41Sopenharmony_ci
1041cb0ef41Sopenharmony_ciWhen set for the `npm init` command, this may be set to the folder of a
1051cb0ef41Sopenharmony_ciworkspace which does not yet exist, to create the folder and set it up as a
1061cb0ef41Sopenharmony_cibrand new workspace within the project.
1071cb0ef41Sopenharmony_ci
1081cb0ef41Sopenharmony_ciThis value is not exported to the environment for child processes.
1091cb0ef41Sopenharmony_ci
1101cb0ef41Sopenharmony_ci#### `workspaces`
1111cb0ef41Sopenharmony_ci
1121cb0ef41Sopenharmony_ci* Default: null
1131cb0ef41Sopenharmony_ci* Type: null or Boolean
1141cb0ef41Sopenharmony_ci
1151cb0ef41Sopenharmony_ciSet to true to run the command in the context of **all** configured
1161cb0ef41Sopenharmony_ciworkspaces.
1171cb0ef41Sopenharmony_ci
1181cb0ef41Sopenharmony_ciExplicitly setting this to false will cause commands like `install` to
1191cb0ef41Sopenharmony_ciignore workspaces altogether. When not set explicitly:
1201cb0ef41Sopenharmony_ci
1211cb0ef41Sopenharmony_ci- Commands that operate on the `node_modules` tree (install, update, etc.)
1221cb0ef41Sopenharmony_ciwill link workspaces into the `node_modules` folder. - Commands that do
1231cb0ef41Sopenharmony_ciother things (test, exec, publish, etc.) will operate on the root project,
1241cb0ef41Sopenharmony_ci_unless_ one or more workspaces are specified in the `workspace` config.
1251cb0ef41Sopenharmony_ci
1261cb0ef41Sopenharmony_ciThis value is not exported to the environment for child processes.
1271cb0ef41Sopenharmony_ci
1281cb0ef41Sopenharmony_ci### See Also
1291cb0ef41Sopenharmony_ci
1301cb0ef41Sopenharmony_ci* [package spec](/using-npm/package-spec)
1311cb0ef41Sopenharmony_ci* [npm deprecate](/commands/npm-deprecate)
1321cb0ef41Sopenharmony_ci* [npm publish](/commands/npm-publish)
1331cb0ef41Sopenharmony_ci* [npm registry](/using-npm/registry)
1341cb0ef41Sopenharmony_ci* [npm adduser](/commands/npm-adduser)
1351cb0ef41Sopenharmony_ci* [npm owner](/commands/npm-owner)
1361cb0ef41Sopenharmony_ci* [npm login](/commands/npm-adduser)
137