claude code 无法连接到 Anthropic 服务
使用npm安装完claude之后。
在命令行输入claude报了如下错误:
Unable to connect to Anthropic services
Failed to connect to api.anthropic.com: ERR BAD REQUEST
lease check your internet connection and network settings.
Note: Claude Code might not be available in your country, Check supported countries atnttps://anthropic.com/supported-countriesS E:ltoollclaude code>

在~目录找到.claude.json,修改如下,在最后添加 "hasCompletedOnboarding": true
{
"installMethod": "unknown",
"autoUpdates": true,
"firstStartTime": "2025-07-14T06:11:03.877Z",
"userID": "f5afdd05117c901a4a5a0761d08230bfcbb76f9fd380ff7bc144cc12c52e55aa",
"projects": {
"/home/nassi": {
"allowedTools": [],
"history": [],
"mcpContextUris": [],
"mcpServers": {},
"enabledMcpjsonServers": [],
"disabledMcpjsonServers": [],
"hasTrustDialogAccepted": false,
"projectOnboardingSeenCount": 0,
"hasClaudeMdExternalIncludesApproved": false,
"hasClaudeMdExternalIncludesWarningShown": false
}
}, //这里要加逗号,注意英文的
"hasCompletedOnboarding": true // 新增字段放在这里,注意位置
}
本文来自博客园,作者:GordonCC,转载请注明原文链接:https://www.cnblogs.com/gordonMlxg/articles/19103691

浙公网安备 33010602011771号