选择命令行版本:
🌐 Synopsis
npm unpublish [<package-spec>]
要了解有关 npm 注册表如何处理撤销发布的更多信息,请参阅我们的 撤销发布政策。
🌐 To learn more about how the npm registry treats unpublish, see our unpublish policies.
🌐 Warning
如果你的目的是鼓励用户升级,或者你不再想维护某个软件包,请考虑改用 deprecate 命令。
🌐 Consider using the deprecate command instead, if your intent is to encourage users to upgrade, or if you no longer want to maintain a package.
🌐 Description
这将从注册表中删除包版本,删除其条目并删除 tarball。
🌐 This removes a package version from the registry, deleting its entry and removing the tarball.
如果你未登录,npm 注册表将返回错误。
🌐 The npm registry will return an error if you are not logged in.
如果你根本不指定包名称,则将从当前目录的项目中拉取要取消发布的名称和版本。
🌐 If you do not specify a package name at all, the name and version to be unpublished will be pulled from the project in the current directory.
如果指定包名称但未指定版本,或者删除包的所有版本,则注册表将完全删除根包条目。
🌐 If you specify a package name but do not specify a version or if you remove all of a package's versions then the registry will remove the root package entry entirely.
即使你取消发布某个包的版本,该特定的名称和版本组合也无法再次使用。为了再次发布该包,你必须使用新的版本号。如果你取消发布整个包,在24小时过去之前,你无法发布该包的任何新版本。
🌐 Even if you unpublish a package version, that specific name and version combination can never be reused. In order to publish the package again, you must use a new version number. If you unpublish the entire package, you may not publish any new versions of that package until 24 hours have passed.
🌐 Configuration
dry-run表示你不希望 npm 做出任何更改,并且它只应该报告本来会做的事情。这个选项可以传递给任何修改本地安装的命令,例如 install、update、dedupe、uninstall,以及 pack 和 publish。
🌐 Indicates that you don't want npm to make any changes and that it should only report what it would have done. This can be passed into any of the commands that modify your local installation, eg, install, update, dedupe, uninstall, as well as pack and publish.
注意:其他与网络相关的命令(例如 dist-tags、owner 等)不支持此项。
🌐 Note: This is NOT honored by other network related commands, eg dist-tags, owner, etc.
force删除了针对不幸的副作用、常见错误、不必要的性能下降和恶意输入的各种保护。
🌐 Removes various protections against unfortunate side effects, common mistakes, unnecessary performance degradation, and malicious input.
npm version 命令在不干净的 git 仓库上运行。npm cache clean 删除缓存文件夹。engines 声明且需要不同版本 npm 的包。engines 声明且需要不同版本的 node 的软件包,即使启用了 --engine-strict。npm audit fix 安装超出你指定依赖范围的模块(包括 SemVer 主版本更改)。npm init 期间隐式设置 --yes。npm pkg 中的现有值如果你对自己想要做什么没有明确的想法,强烈建议你不要使用此选项!
🌐 If you don't have a clear idea of what you want to do, it is strongly recommended that you do not use this option!
workspace启用在当前项目的已配置工作区的上下文中运行命令,同时通过仅运行此配置选项定义的工作区进行过滤。
🌐 Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.
workspace 配置的有效值为以下之一:
🌐 Valid values for the workspace config are either:
对于 npm init 命令设置时,可以将其设置为一个尚不存在的工作区文件夹,以创建该文件夹并将其作为项目内全新的工作区进行设置。
🌐 When set for the npm init command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.
此值不会导出到子进程的环境中。
🌐 This value is not exported to the environment for child processes.
workspaces设置为 true 以在 所有 配置的工作区上下文中运行命令。
🌐 Set to true to run the command in the context of all configured workspaces.
将此显式设置为 false 会导致像 install 这样的命令完全忽略工作区。如果不显式设置:
🌐 Explicitly setting this to false will cause commands like install to ignore workspaces altogether. When not set explicitly:
node_modules 树操作的命令(安装、更新等)会将工作区链接到 node_modules 文件夹。- 执行其他操作的命令(测试、执行、发布等)会在根项目上运行,除非 在 workspace 配置中指定了一个或多个工作区。此值不会导出到子进程的环境中。
🌐 This value is not exported to the environment for child processes.
🌐 See Also