Javascript 如何从 npm 注册表中删除 npm 包?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36927974/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to delete an npm package from the npm registry?
提问by KhaledMohamedP
Is there a possible way to remove or delete the entire module from npm registry?
有没有可能的方法从 npm 注册表中删除或删除整个模块?
Notice: npm -f unpublish
doesn't allowed you to unpublish anything older than 24 hours
注意:npm -f unpublish
不允许您取消发布超过 24 小时的任何内容
采纳答案by Joseph
There's a post about that, given the recent incident. Your best bet would be to contact npm and hope that your package isn't depended by other projects.
鉴于最近的事件,有一篇关于此的帖子。你最好的办法是联系 npm 并希望你的包不被其他项目依赖。
If the version is older than 24 hours, then the unpublish will fail, with a message to contact [email protected].
If you contact support, they will check to see if removing that version of your package would break any other installs. If so, we will not remove it. You'll either have to transfer ownership of the package or reach out to the owners of dependent packages to change their dependency.
http://blog.npmjs.org/post/141905368000/changes-to-npms-unpublish-policy
如果版本早于 24 小时,则取消发布将失败,并发送消息至 [email protected]。
如果您联系支持人员,他们将检查删除该版本的软件包是否会破坏任何其他安装。如果是这样,我们不会删除它。您要么必须转让包的所有权,要么与依赖包的所有者联系以更改他们的依赖项。
http://blog.npmjs.org/post/141905368000/changes-to-npms-unpublish-policy
回答by chanjsq
TL;DR:
特尔;博士:
npm force-unpublish package-name 'reason message'
Explanation:
解释:
npm deprecate package-name 'reason message'
npm owner add npm package-name
npm owner rm $(npm whoami) package-name
npm deprecate package-name 'reason message'
npm owner add npm package-name
npm owner rm $(npm whoami) package-name
回答by ryan
I stumbled upon this problem where i had to delete an existing package. And the following worked seamlessly. I noticed that the package was removed from my account immediately (It was a test package with no dependency.)
我偶然发现了这个问题,我不得不删除现有的包。以下工作无缝衔接。我注意到该包立即从我的帐户中删除(这是一个没有依赖项的测试包。)
npm --force unpublish "package-name"
npm --force unpublish "package-name"
You might have to enter OTP/Auth key if you have configured 2FA on npm account.
如果您在 npm 帐户上配置了 2FA,则可能需要输入 OTP/Auth 密钥。
回答by Julian Tellez
From the docs: https://www.npmjs.com/policies/unpublish
来自文档:https: //www.npmjs.com/policies/unpublish
npm deprecate <package> "<message>" to deprecate the entire package
npm deprecate <package>@<version> "<message>" to deprecate a specific version
If the entire package is deprecated, the package name will be dropped from our search results.
Once deprecated, if you would also like for the package to be removed from your user profile,
it can be transferred to our @npm account. This can be achieved by using the following from your command line:
npm owner add npm <package>
npm owner rm <your_username> <package>