pnpm runtime <cmd>
管理运行时。
🌐 Manage runtimes.
别名:rt
🌐 Alias: rt
命令
🌐 Commands
set
安装指定版本的运行时。
🌐 Install the specified version of a runtime.
pnpm runtime set <name> <version> [-g]
支持的运行时
🌐 Supported runtimes
-
node- Node.js -
deno- Deno -
bun- Bun
自 v11.0.0 起,安装 Node.js 运行时(通过 pnpm runtime set node … 或 node@runtime:<version>)不会从 Node.js 存档中解压打包的 npm、npx 和 corepack。这大约将 pnpm 在运行时安装过程中需要哈希、写入 CAS 并链接的文件数量减半。如果你仍然需要 npm,请使用 pnpm add -g npm 单独安装它。
🌐 Since v11.0.0, installing a Node.js runtime (via pnpm runtime set node … or node@runtime:<version>) does not extract the bundled npm, npx, and corepack from the Node.js archive. This roughly halves the number of files pnpm has to hash, write to the CAS, and link during a runtime install. If you still need npm, install it separately with pnpm add -g npm.
示例
🌐 Examples
全局安装 Node.js v22:
🌐 Install Node.js v22 globally:
pnpm runtime set node 22 -g
安装 Node.js 的 LTS 版本:
🌐 Install the LTS version of Node.js:
pnpm runtime set node lts -g
安装 Node.js 的最新版本:
🌐 Install the latest version of Node.js:
pnpm runtime set node latest -g
安装 Node.js 的预发布版本:
🌐 Install a prerelease version of Node.js:
pnpm runtime set node nightly -g
pnpm runtime set node rc -g
pnpm runtime set node rc/22 -g
pnpm runtime set node 22.0.0-rc.4 -g
使用其[代号]安装 Node.js 的 LTS 版本:
🌐 Install an LTS version of Node.js using its codename:
pnpm runtime set node argon -g
安装 Deno:
🌐 Install Deno:
pnpm runtime set deno 2 -g
安装 Bun:
🌐 Install Bun:
pnpm runtime set bun latest -g
选项
🌐 Options
--global, -g
全局安装运行时。
🌐 Install the runtime globally.