Skip to main content
Version: Next

pnpm dist-tag

新增于:v11.0.0

🌐 Added in: v11.0.0

管理软件包的分发标签。分发标签提供人类可读的别名(如 latestnextbeta),指向注册表上的特定软件包版本。

🌐 Manage distribution tags for a package. Dist-tags provide human-readable aliases (like latest, next, beta) that point to specific package versions on the registry.

pnpm dist-tag add <pkg>@<version> [<tag>]
pnpm dist-tag rm <pkg> <tag>
pnpm dist-tag ls [<pkg>]

子命令

🌐 Subcommands

add <pkg>@<version> [<tag>]

使用 dist-tag 为软件包的指定版本打标签。如果省略 <tag>,则使用 tag 设置的值(默认为 latest)。

🌐 Tag the specified version of a package with a dist-tag. If <tag> is omitted, the value of the tag setting is used (defaults to latest).

pnpm dist-tag add foo@1.2.0 next

rm <pkg> <tag>

从包中移除 dist-tag。

🌐 Remove a dist-tag from a package.

pnpm dist-tag rm foo next

ls [<pkg>]

列出一个包的所有 dist-tags。如果未提供包名称,将显示当前包(从本地 package.json 读取)的 dist-tags。

🌐 List all dist-tags for a package. If no package name is given, the dist-tags for the current package (read from the local package.json) are shown.

pnpm dist-tag ls foo

选项

🌐 Options

--registry <url>

要操作的注册表。默认为包配置的注册表。

🌐 The registry to operate on. 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.