目录
从注册表中取消发布包
目录
作为包所有者或合作者,如果你的包没有依赖,你可以使用 CLI 将其从 npm 注册表中永久删除。你可以在初始发布后 72 小时内 取消发布;超过 72 小时,如果 它符合某些标准,你仍然可以取消发布你的包。
¥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 within 72 hours of the initial publish; beyond 72 hours, you can still unpublish your package if it meets certain criteria.
设置这些标准是为了避免破坏 JavaScript 包生态系统。如果你不能取消发布你的包,你可以 改为弃用它。
¥These criteria are set to avoid damaging the JavaScript package ecosystem. If you cannot unpublish your package, you can deprecate it instead.
注意:从包中删除所有协作者或团队不会取消发布它。
¥Note: Removing all the collaborators or teams from the package will not unpublish it.
取消发布包
¥Unpublishing a package
如果你想从注册表中完全删除一个包的所有版本,你可以完全取消发布它。这将从注册表中删除它,并且将无法安装。
¥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.
要取消发布包,你必须满足 包取消发布规则 的要求。
¥To unpublish a package, you must meet the requirements of the package unpublishing rules.
使用网站
¥Using the website
-
在 npm“登录”页面上,输入您的帐户详细信息并单击登录。
-
导航到你要取消发布的包的包页面,将
<your-package-name>
替换为你的包名称:https://www.npmjs.com/package/<your-package-name>
。¥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>
. -
单击“设置”。
¥Click Settings.
-
在 "删除包" 下,单击 Delete package。
¥Under "delete package", click Delete package.
注意:如果你因为不符合 取消发布要求 而无法删除包,则删除包选项将不可用。相反,系统会提示你选择 弃用包。
¥Note: If you cannot delete the package because it does not meet the unpublishing requirements, then the delete package option will not be available. Instead, you will be prompted to deprecate the package.
-
如果你确定要继续,请输入你的包名称并单击 Delete package。
¥If you are sure that you want to continue, enter your package name and click Delete package.
使用命令行
¥Using the command line
要取消发布整个包,请运行以下命令,将 <package-name>
替换为包的名称:
¥To unpublish an entire package, run the following command, replacing <package-name>
with the name of your package:
npm unpublish <package-name> -f
如果你为写入启用了 双重身份验证,则需要向 unpublish
命令 --otp=123456
添加一次性密码(其中 123456 是你的身份验证器应用的代码)。
¥If you have two-factor authentication 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).