如何使用更新的标签更新 npm 包

How do I update an npm package with an updated tag

我向 npm public 存储库发布了一个新标签,然后将标签推送到 git,但我意识到我忘记更新标签编号。在 git 中,我只是删除了标签并使用新的提交重新创建了它,但是我将如何在 npm 存储库中更新版本?

如果你想将它发布到与你之前在 npm 上的版本相同的版本,你需要使用以下代码片段来取消发布你的包。完成后您需要重新发布您的包。

然而,NPM 表示 "It is generally considered bad behavior to remove versions of a library that others are depending on!Consider using the deprecate command instead, if your intent is to encourage users to upgrade."

npm unpublish [<@scope>/]<pkg>[@<version>]

查看 npm docs