Skip to main content
Version: 11.x

pnpm pm

pnpm pm <command> 语法总是运行内置的 pnpm 命令,绕过 package.json 中同名的脚本。

🌐 The pnpm pm <command> syntax always runs the built-in pnpm command, bypassing any same-named script in package.json.

一些内置命令可以被脚本覆盖。例如,如果你的项目在 package.json 中定义了一个 "clean" 脚本,那么 pnpm clean 会运行该脚本,而不是内置的 pnpm clean。使用 pnpm pm clean 会强制运行内置命令。

🌐 Some built-in commands can be overridden by scripts. For example, if your project defines a "clean" script in package.json, then pnpm clean runs that script instead of the built-in pnpm clean. Using pnpm pm clean forces the built-in command to run.

例子

🌐 Example

package.json
{
"scripts": {
"clean": "rm -rf dist"
}
}
# Runs the "clean" script from package.json
pnpm clean
# or explicitly:
pnpm run clean

# Runs the built-in pnpm clean command (removes node_modules)
pnpm pm clean