安装nodejs22+环境
使用使用 NodeSource
首先,添加 NodeSource 的 PPA(个人包存档)
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
然后安装nodejs
apt-get install -y nodejs
使用n管理器
如果你想使用 n 管理器安装最新版本,可以先安装 n
npm install -g n
然后使用 n 安装 Node.js 22
n 22
验证安装
安装完成后,可以通过以下命令验证 Node.js 是否安装成功
node -v
安装pnpm
若已安装npm
版本不确定
npm install -g pnpm
使用独立脚本安装(不用安装nodejs)
Windows PowerShell
Invoke-WebRequest https://get.pnpm.io/install.ps1 -UseBasicParsing | Invoke-Expression
在POSIX系统上
curl -fsSL https://get.pnpm.io/install.sh | sh -
# 或者使用
# wget -qO- https://get.pnpm.io/install.sh | sh -
安装特定的版本
在运行安装脚本之前,你可以选择设置环境变量 PNPM_VERSION 来安装特定版本的 pnpm
curl -fsSL https://get.pnpm.io/install.sh | env PNPM_VERSION=<version> sh -
comment 评论区
star_outline 咱快来抢个沙发吧!