环境准备
Claude Code、Codex 和 Gemini CLI 都支持通过 npm 安装。请根据你的操作系统完成以下环境准备。
MacOS
brew install node
Linux (Ubuntu/Debian)
sudo apt install nodejs npm
Windows
步骤 1: 安装 Chocolatey(Windows 包管理器)
1) 以管理员身份打开 PowerShell
2) 运行以下命令并按 Y 确认:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
3) 然后运行:
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
4) 等待安装完成后,关闭并重新打开 PowerShell(以管理员身份),验证安装:
choco --version
步骤 2: 安装 Node.js 和 Git
choco install nodejs git -y
刷新环境变量:
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
安装完成后,可以验证:
node --version
npm --version
git --version
可选:一次安装常用 CLI 工具
如果你准备同时使用 Claude Code、Codex 和 Gemini CLI,可以在 Node.js / npm 可用后一次安装:
npm i -g @anthropic-ai/claude-code
npm i -g @openai/codex@latest
npm i -g @google/gemini-cli
Windows 用户安装后建议新开 PowerShell,再验证:
claude --version
codex --version
gemini --version