pnpm unpublish
新增于:v11.0.0
🌐 Added in: v11.0.0
从注册表中删除已发布的软件包版本。
🌐 Remove a published package version from the registry.
pnpm unpublish [<pkg>[@<version>]] [--force]
通常不鼓励撤销发布。大多数注册表(包括公共 npm 注册表)都会限制包何时以及如何可以被撤销发布。尽可能优先使用 pnpm deprecate。
🌐 Unpublishing is generally discouraged. Most registries (including the public npm registry) restrict when and how packages can be unpublished. Prefer pnpm deprecate whenever possible.
示例
🌐 Examples
取消发布特定版本:
🌐 Unpublish a specific version:
pnpm unpublish foo@1.0.0
使用 semver 指定符取消发布一系列版本:
🌐 Unpublish a range of versions using a semver specifier:
pnpm unpublish "foo@<2"
取消发布整个包(所有版本)。需要 --force:
🌐 Unpublish an entire package (all versions). Requires --force:
pnpm unpublish foo --force
当在包目录中不带参数运行时,pnpm 会从本地 package.json 读取当前包版本并将其取消发布。
🌐 When run without arguments inside a package directory, pnpm unpublishes the current package version read from the local package.json.
选项
🌐 Options
--force
当移除整个软件包(所有版本)而不是特定版本或范围时需要。
🌐 Required when removing an entire package (all versions) rather than a specific version or range.
--registry <url>
要发布到的注册表。默认为包配置的注册表。
🌐 The registry to publish to. Defaults to the registry configured for the package.
--otp <code>
当注册表要求两步验证时,通过此标志或 PNPM_CONFIG_OTP 环境变量提供一次性密码。
🌐 When the registry requires two-factor authentication, supply the one-time password via this flag or the PNPM_CONFIG_OTP environment variable.