reggi/cache-based-on-version
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: Unpublishing packages from the registry |
| 3 | --- |
| 4 | |
| 5 | import shared from '~/shared.js' |
| 6 | |
| 7 | As a package owner or collaborator, if your package has no dependents, you can permanently remove it from the npm registry by using the CLI. You can [unpublish](https://docs.npmjs.com/cli/commands/npm-unpublish) within 72 hours of the initial publish; beyond 72 hours, you can still unpublish your package if [it meets certain criteria](https://www.npmjs.com/policies/unpublish). |
| 8 | |
| 9 | These criteria are set to avoid damaging the JavaScript package ecosystem. If you cannot unpublish your package, you can [deprecate it instead](/deprecating-and-undeprecating-packages-or-package-versions). |
| 10 | |
| 11 | <Note> |
| 12 | |
| 13 | **Note:** Removing all the collaborators or teams from the package will not unpublish it. |
| 14 | |
| 15 | </Note> |
| 16 | |
| 17 | ## Unpublishing a package |
| 18 | |
| 19 | If you want to completely remove all versions of a package from the registry, you can unpublish it completely. This will delete it from the registry and it will be unable to be installed. |
| 20 | |
| 21 | To unpublish a package, you must meet the requirements of the [package unpublishing rules][unpublish]. |
| 22 | |
| 23 | ### Using the website |
| 24 | |
| 25 | 1. <>{shared['user-login'].text}</> |
| 26 | |
| 27 | <>{shared['user-login'].image}</> |
| 28 | |
| 29 | 2. Navigate to the package page for the package you want to unpublish, replacing `<your-package-name>` with the name of your package: `https://www.npmjs.com/package/<your-package-name>`. |
| 30 | |
| 31 | 3. Click **Settings**. |
| 32 | |
| 33 | <Screenshot src="/packages-and-modules/securing-your-code/2fa-package-admin.png" alt="Screenshot showing the admin tab on a package page" /> |
| 34 | |
| 35 | 4. Under "delete package", click <strong>Delete package</strong>. |
| 36 | |
| 37 | <Screenshot src="/packages-and-modules/deleting-deprecating/delete-package-settings.png" alt="Screenshot showing the admin tab on a package page" /> |
| 38 | |
| 39 | <Note> |
| 40 | |
| 41 | **Note:** If you cannot delete the package because it does not meet the [unpublishing requirements][unpublish], then the delete package option will not be available. Instead, you will be prompted to [deprecate the package](/deprecating-and-undeprecating-packages-or-package-versions#deprecating-a-package-from-the-website). |
| 42 | |
| 43 | </Note> |
| 44 | |
| 45 | 5. If you are sure that you want to continue, enter your package name and click <strong>Delete package</strong>. |
| 46 | |
| 47 | <Screenshot src="/packages-and-modules/deleting-deprecating/delete-package-confirm.png" alt="Screenshot showing the admin tab on a package page" /> |
| 48 | |
| 49 | ### Using the command line |
| 50 | |
| 51 | To unpublish an entire package, run the following command, replacing `<package-name>` with the name of your package: |
| 52 | |
| 53 | ``` |
| 54 | npm unpublish <package-name> -f |
| 55 | ``` |
| 56 | |
| 57 | If you have [two-factor authentication][two-factor-auth] enabled for writes, you will need to add a one-time password to the `unpublish` command, `--otp=123456` (where _123456_ is the code from your authenticator app). |
| 58 | |
| 59 | If you need help unpublishing your package, please <>{shared['contact-support'].text}</>. If you are an Enterprise customer, please <>{shared['contact-enterprise-support'].text}</>. |
| 60 | |
| 61 | <Note> |
| 62 | |
| 63 | **Note:** If you unpublish an entire package, you may not publish any new versions of that package until 24 hours have passed. |
| 64 | |
| 65 | </Note> |
| 66 | |
| 67 | ## Unpublishing a single version of a package |
| 68 | |
| 69 | If you want to remove a single version of a package, you can unpublish one version without affecting the others. This will delete only that version from the registry and it will be unable to be installed. This option is only available via the npm CLI. |
| 70 | |
| 71 | ### Using the command line |
| 72 | |
| 73 | To unpublish a single version of a package, run the following command, replacing `<package-name>` with the name of your package, and `<version>` with your version number: |
| 74 | |
| 75 | ``` |
| 76 | npm unpublish <package-name>@<version> |
| 77 | ``` |
| 78 | |
| 79 | ## When to unpublish |
| 80 | |
| 81 | Unpublishing a package permanently removes the package from the registry so it is no longer available for other users to install. Once a package is unpublished, republishing under the same name is blocked for 24 hours. If you've unpublished a package by mistake, we'd recommend publishing again under a different name, or for unpublished versions, bumping the version number and publishing again. |
| 82 | |
| 83 | You might want to unpublish a package because you: |
| 84 | |
| 85 | - Published something accidentally. |
| 86 | - Wanted to test npm. |
| 87 | - Published content you [didn't intend to be public][oh-no]. |
| 88 | - Want to rename a package. (The only way to rename a package is to re-publish it under a new name) |
| 89 | |
| 90 | <Note> |
| 91 | |
| 92 | **Note:** `package-name@version` is unique, and cannot be reused by unpublishing and re-publishing it. We recommend publishing a minor version update instead. |
| 93 | |
| 94 | </Note> |
| 95 | |
| 96 | ## When to deprecate |
| 97 | |
| 98 | If you are no longer interested in maintaining a package, but want it to remain available for users to install, or if your package has dependents, we'd recommend [deprecating][deprecate-cli] it. To learn about how to deprecate a package, see "[Deprecating and undeprecating packages or package versions][deprecate-package]". |
| 99 | |
| 100 | [oh-no]: https://blog.npmjs.org/post/101934969510/oh-no-i-accidentally-published-private-data-to |
| 101 | [deprecate-cli]: cli/deprecate |
| 102 | [deprecate-package]: deprecating-and-undeprecating-packages-or-package-versions |
| 103 | [two-factor-auth]: about-two-factor-authentication |
| 104 | [unpublish]: /policies/unpublish |
| 105 | [unpublish-cli]: /cli/unpublish |