pnpm runtime <cmd>
管理运行时。
别名:rt
命令
set
安装指定版本的运行时环境。
pnpm runtime set <name> <version> [-g]
支持的运行时
node- Node.jsdeno- Denobun- 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 单独安装它。
示例
全局安装 Node.js v22:
pnpm runtime set node 22 -g
安装 Node.js 的 LTS 版本:
pnpm runtime set node lts -g
安装最新版本的 Node.js:
pnpm runtime set node latest -g
安装 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 版本:
pnpm runtime set node argon -g
安装 Deno:
pnpm runtime set deno 2 -g
安装 Bun:
pnpm runtime set bun latest -g
配置项
--global, -g
全局安装运行时环境。