系统要求
基础环境
- Node.js 18+ 环境
- Windows 10/11、macOS 10.15+、或 Linux
- 稳定的网络连接
- 至少 100MB 可用磁盘空间
推荐配置
- 8GB 或更多内存
- 现代化的终端工具
- 代码编辑器(VS Code 推荐)
- Git 版本控制工具
安装步骤
macOS 系统安装
步骤 1: 安装 Node.js
从官网下载并安装 Node.js 18 或更高版本
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo bash -
sudo apt-get install -y nodejs
node --version
npm --version
步骤 2: 安装 Claude Code
使用 npm 全局安装 Claude Code
npm install -g @anthropic-ai/claude-code
步骤 3: 验证安装
检查是否安装成功
claude --version
步骤 4: 配置 API 密钥
设置您的 IMYAI API 密钥
claude config set-key YOUR_API_KEY
Windows 系统安装
注意: Windows 用户建议使用 Git Bash 或 PowerShell 以获得更好的终端体验。
步骤 1: 安装 Node.js
从 nodejs.org 下载 Windows 安装包并安装
# 在命令提示符中检查版本
node --version
npm --version
步骤 2: 安装 Git Bash(推荐)
为了更好的终端体验,建议安装 Git Bash
# 下载地址:https://git-scm.com/download/win
步骤 3: 安装 Claude Code
在 Git Bash 或 PowerShell 中运行
pnpm install -g @anthropic-ai/claude-code
步骤 4: 配置环境
设置 API 密钥和基本配置
claude config set-key YOUR_API_KEY
claude config set-endpoint https://code.imyaichat.com
Linux 系统安装
步骤 1: 安装 Node.js
使用包管理器安装 Node.js
# Ubuntu/Debian
sudo apt update
sudo apt install nodejs npm
# CentOS/RHEL
sudo yum install nodejs npm
步骤 2: 安装 Claude Code
使用 npm 全局安装
sudo npm install -g @anthropic-ai/claude-code
步骤 3: 设置权限
确保有正确的执行权限
sudo chmod +x /usr/local/bin/claude
步骤 4: 配置服务
设置 API 密钥和服务端点
claude config set-key YOUR_API_KEY
claude config set-endpoint https://code.imyaichat.com
常用命令
claude --help
查看所有可用命令和选项
claude --continue
继续最近的对话
claude config list
查看当前配置信息
claude status
检查服务状态和连接
常见问题解决
安装失败:权限错误
使用 sudo(Linux/macOS)或以管理员身份运行(Windows)
Node.js 版本过低
升级到 Node.js 18 或更高版本
网络连接超时
检查网络连接,或使用国内 npm 镜像源
API 密钥无效
确认密钥正确,或重新获取新的密钥