安装 node
js
# 国内镜像安装 nvm(完全不走 GitHub,必成功)
export NVM_SOURCE="https://gitee.com/mirrors/nvm.git"
curl -fsSL https://gitee.com/mirrors/nvm/raw/master/install.sh | bash1
2
3
2
3
然后执行:
js
source ~/.bashrc1
接下来安装 Node.js(国内加速)
js
# 使用淘宝镜像安装 Node,速度飞快
NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node nvm install --lts
node -v
npm -v1
2
3
4
5
2
3
4
5
最后安装 Claude Code(无 sudo)
js
# 国内 npm 镜像
npm config set registry https://registry.npmmirror.com1
2
3
2
3
安装
js
npm install -g @anthropic-ai/claude-code1
运行
js
claude --version1
echo 'export ANTHROPIC_AUTH_TOKEN="sk-你的密钥"' >> ~/.bashrc echo 'export ANTHROPIC_BASE_URL="https://api.xxx.com"' >> ~/.bashrc
source ~/.bashrc