npm-deprecate

弃用某个版本的包

选择命令行版本:

概要

🌐 Synopsis

npm deprecate <package-spec> <message>

注意:此命令不支持工作区。

🌐 Note: This command is unaware of workspaces.

描述

🌐 Description

此命令将更新包的 npm 注册表项,向所有尝试安装它的人提供弃用警告。

🌐 This command will update the npm registry entry for a package, providing a deprecation warning to all who attempt to install it.

它适用于版本范围以及特定版本,所以你可以这样做:

🌐 It works on version ranges as well as specific versions, so you can do something like this:

npm deprecate my-thing@"< 0.2.3" "critical bug fixed in v0.2.3"

传递给此命令的 SemVer 范围被解释为包含预发布版本。例如:

🌐 SemVer ranges passed to this command are interpreted such that they do include prerelease versions. For example:

npm deprecate my-thing@1.x "1.x is no longer supported"

在这种情况下,版本 my-thing@1.0.0-beta.0 也将被弃用。

🌐 In this case, a version my-thing@1.0.0-beta.0 will also be deprecated.

你必须是软件包的拥有者才能弃用某个内容。请参阅 owneradduser 帮助主题。

🌐 You must be the package owner to deprecate something. See the owner and adduser help topics.

要取消弃用一个软件包,请为 message 参数指定一个空字符串("")。请注意,必须使用不带空格的双引号来表示空字符串。

🌐 To un-deprecate a package, specify an empty string ("") for the message argument. Note that you must use double quotes with no space between them to format an empty string.

配置

🌐 Configuration

registry

  • 默认: "https://registry.npmjs.org/"
  • 类型:网址

npm 注册表的基本 URL。

🌐 The base URL of the npm registry.

otp

  • 默认值:空
  • 类型:空或字符串

这是来自双因素认证器的一次性密码。在使用 npm access 发布或更改软件包权限时需要此密码。

🌐 This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with npm access.

如果未设置,并且注册表响应失败并询问一次性密码,npm 将在命令行上提示输入一次密码。

🌐 If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.

也可以看看

🌐 See Also