Skip to main content
Version: 11.x

pnpm deprecate

新增于:v11.0.0

🌐 Added in: v11.0.0

在已发布的包版本上设置弃用消息。运行 pnpm install 的使用者在安装匹配版本时会看到此消息。

🌐 Set a deprecation message on a published package version. Consumers running pnpm install will see this message when the matching version is installed.

pnpm deprecate <pkg>[@<version-range>] <message>

要清除弃用消息,请使用 pnpm undeprecate 或传递一个空字符串:

🌐 To clear a deprecation message, use pnpm undeprecate or pass an empty string:

pnpm deprecate foo@1.0.0 ""

示例

🌐 Examples

弃用单个版本:

🌐 Deprecate a single version:

pnpm deprecate foo@1.0.0 "Use foo@2 instead"

弃用一系列版本:

🌐 Deprecate a range of versions:

pnpm deprecate "foo@<2" "Please upgrade to foo@2"

弃用所有版本:

🌐 Deprecate all versions:

pnpm deprecate foo "This package is no longer maintained"

选项

🌐 Options

--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.

pnpm undeprecate

从软件包版本中移除弃用消息。等同于运行 pnpm deprecate <pkg>[@<version-range>] ""

pnpm undeprecate <pkg>[@<version-range>]