Skip to content

Node.js 环境安装教程

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

提示

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

安装 Node.js

powershell
# 方法一:官方下载(推荐)
# 前往 https://nodejs.org 下载 LTS 版本,双击安装包按提示安装

# 方法二:使用 Chocolatey
choco install nodejs-lts

# 方法三:使用 Scoop
scoop install nodejs-lts
bash
# 方法一:使用 Homebrew(推荐)
brew install node

# 方法二:官方下载
# 前往 https://nodejs.org 下载 macOS 安装包
bash
# Ubuntu / Debian
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs

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

验证安装

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

bash
node --version
npm --version

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

下一步