Baka API

环境准备

Claude Code 安装前的环境配置

环境准备

在安装 Claude Code 之前,请确保你的系统已安装以下依赖。

Git

Git 是 Claude Code 的核心依赖,缺少它会导致启动失败。

  1. 访问 Git 官网 下载安装包
  2. 运行安装程序,全程使用默认设置即可

Git 请务必安装在 C 盘(默认路径),安装到其他盘可能会引发一些难以排查的问题。

  1. 安装完成后,打开终端验证:
git --version

macOS 通常自带 Git,如未安装可通过 Homebrew 安装:

brew install git

使用包管理器安装:

# Ubuntu / Debian
sudo apt install git

# CentOS / RHEL
sudo yum install git

# Arch Linux
sudo pacman -S git

Node.js

Claude Code 需要 Node.js 18 或更高版本。

  1. 访问 Node.js 官网 下载 LTS 版本的 .msi 安装包
  2. 运行安装程序,按提示完成安装
  3. 打开终端验证:
node -v
npm -v

如果已安装旧版本 Node.js,请先在「设置 → 应用」中卸载后再安装新版本。

推荐使用 Homebrew 安装:

brew install node

或从 Node.js 官网 下载 .pkg 安装包。

# Ubuntu / Debian (使用 NodeSource)
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs

# 或使用 nvm(推荐)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
source ~/.bashrc
nvm install 20

验证清单

安装完成后,确保以下命令都能正常输出版本号:

git --version   # 应显示 git version 2.x.x
node -v         # 应显示 v18.x.x 或更高
npm -v          # 应显示 9.x.x 或更高

全部通过后,即可根据你的系统进入安装步骤:

On this page