Skip to content

Node.js 环境安装 ​

在 Windows、macOS、Linux 安装 Node.js LTS,并验证 node/npm 命令可用。

后续的 Codex、Claude Code、Gemini CLI 都依赖 Node.js 运行环境。先完成本教程,再继续各自工具配置。

Windows ​

方法一:官方下载(推荐)

前往 Node.js 官网 下载 LTS 版本,双击安装包按提示安装即可。

方法二:使用 Chocolatey

Bash
choco install nodejs-lts

方法三:使用 Scoop

Bash
scoop install nodejs-lts

macOS ​

方法一:使用 Homebrew(推荐)

Bash
brew install node

方法二:官方下载

前往 Node.js 官网 下载 macOS 安装包。

Linux ​

Ubuntu / Debian:

Bash
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

CentOS / RHEL:

Bash
curl -fsSL https://rpm.nodesource.com/setup_lts.x | sudo bash -
sudo yum install -y nodejs

验证安装 ​

安装完成后,在终端执行:

Bash
node --version
npm --version

如果能输出版本号,说明 Node.js 与 npm 已可用。