安装 nodejs
Claude Code 需要 Node.js 环境才能运行。
不建议挂T,使用官方仓库下载nodejs
bash
# 添加 NodeSource 仓库
curl -fsSL https://deb.nodesource.com/setup_lts.x | sh
# 安装 Node.js
apt-get install -y nodejs
apt-get install -y npm
bash
node --version
npm --version
显示版本号,说明安装成功。
安装Claude
bash
npm install -g @anthropic-ai/claude-code
如果安装出现error,需要更换nodejs的版本
bash
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
source ~/.bashrc
nvm install 18
nvm use 18
再次执行claude安装指令即可。