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  // 新增字段放在这里,注意位置
}
posted @ 2025-09-21 15:18  GordonCC  阅读(1900)  评论(0)    收藏  举报