← 使用教程
准备环境:安装 Node.js 与 Git
Codex 和 Claude Code 的 npm 安装方式都需要 Node.js;Git 让 Claude Code 在 Windows 上能用 Bash、让 Codex 能对比修改。
需要装什么
| 软件 | 用途 | 是否必须 |
|---|---|---|
| Node.js(22 或更高) | 用 npm 安装 Codex、Claude Code | 用 npm 安装时必须 |
| Git | 版本管理;Claude Code 在 Windows 上靠它提供 Bash | 强烈推荐 |
| VS Code | 在编辑器里用 Claude Code / Codex 插件 | 可选,见 VS Code 插件教程 |
小提示 官网打不开或下载很慢?下载中心 有 EasyCode 准备好的 Windows / macOS 安装包合集,Node.js、Git、CC Switch 都在里面,还附带 Claude Code 和 Codex 的一键安装脚本。
安装 Node.js
打开 Node.js 官网下载页,选 macOS,下载 .pkg 安装包双击安装。装了 Homebrew 的话,也可以在终端运行:
brew install node
装好后重新打开一个终端,检查版本(Node.js 需要 22 或更高):
node -v npm -v
国内网络:设置 npm 镜像(推荐)
在国内直连 npm 官方源可能很慢甚至失败,换成国内镜像能快很多:
npm config set registry https://registry.npmmirror.com
说明 想换回官方源:
npm config set registry https://registry.npmjs.org。安装 Git
macOS 第一次在终端输入 git 时会提示安装「命令行开发者工具」,点安装即可;或者用 Homebrew:
brew install git
检查是否安装成功:
git --version
Windows:允许 PowerShell 运行 npm 命令
如果在 PowerShell 里运行 npm、codex 或 claude 时看到「因为在此系统上禁止运行脚本」,执行下面这行放开当前用户的限制(只需一次):
PowerShell
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned