Cluade Code使用国产平台(如MiniMax,GLM)的配置流程

首先安装node.js: https://nodejs.org/zh-cn/download

安装后通过npm安装pnpm:npm install -g pnpm@latest-10

然后用pnpm安装Cluade Code: pnpm install -g @anthropic-ai/claude-code

网络问题请换源: pnpm config set registry https://registry.npmmirror.com/

然后编辑~/.claude/settings.json,内容国产平台的教程上应该有

由于Cluade Code禁止了一些国家和地区,所以需要绕过其验证,编辑~/.claude.json,在json的根目录(也就是{}内)增加一行: “hasCompletedOnboarding”: true,如:

然后保存退出来,运行:

node --eval "
const homeDir = os.homedir();
const filePath = path.join(homeDir, '.claude.json');
if (fs.existsSync(filePath)) {
const content = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
fs.writeFileSync(filePath,JSON.stringify({ …content, hasCompletedOnboarding: true }, 2), 'utf-8');
} else {
fs.writeFileSync(filePath,JSON.stringify({ hasCompletedOnboarding: true }), 'utf-8');
}"

之后进入项目根目录输入claude即可正常使用:

发表评论