claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

i use mac,and in support country; but input "claude" reprot Unable to connect to Anthropic services;

Open xuhongxin opened this issue 1 year ago • 14 comments

Unable to connect to Anthropic services

Failed to connect to api.anthropic.com: ECONNREFUSED

Please check your internet connection and network settings.

Note: Claude Code might not be available in your country. Check supported countries at https://anthropic.com/supported-countries

xuhongxin avatar Jun 18 '25 23:06 xuhongxin

I also see this error.

mwarger avatar Jun 20 '25 00:06 mwarger

@xuhongxin I managed to figure out that when installing claude globally it was located in opt/homebrew since I had installed node with homebrew. I uninstalled node and also uninstalled node. I then used nvm to install node instead, and globally installed claude again with npm install -g @anthropic-ai/claude-code - at this point the installation was now in my nvm folder instead. I ran claude again and it worked.

mwarger avatar Jun 20 '25 00:06 mwarger

thank you ,but my claude now is in the nvm path; the whole path is:

/Users/xuhongxin8477/.nvm/versions/node/v22.14.0/bin/claude;

and the error is still there

xuhongxin avatar Jun 21 '25 00:06 xuhongxin

I am also unable to start Claude code from the command line on my Mac:

➜ claude --verbose doctor

 Claude CLI Diagnostic
 Currently running: npm-local (1.0.58)
 Path: /usr/local/Cellar/node/24.4.1/bin/node
 Invoked: /Users/holger/.claude/local/node_modules/.bin/claude
 Config install method: local
 Auto-updates enabled: true
 Warning: Multiple installations found
 - npm-local at /Users/holger/.claude/local
 - npm-global at /usr/local/bin/claude
 Press Enter to continue…

pandel avatar Jul 23 '25 13:07 pandel

MacOS user I fixed it by deleting all those claude config files: rm -rf ~/.claude* and then reinstall claude, and it works.

NickJay159 avatar Jul 24 '25 04:07 NickJay159

I experienced the same issue on my Mac and finally found this solution worked for me:

  1. Open your .claude.json in your home folder;
  2. Add the below line into the json and save;
"hasCompletedOnboarding": true

The complete json after the modification would look like:

{
  "installMethod": "unknown",
  "autoUpdates": true,
  "userID": "[your_user_id]",
  "firstStartTime": "[time]",
  "projects": {
    "/Users/[your_home_folder]": {
      "allowedTools": [],
      "history": [],
      "mcpContextUris": [],
      "mcpServers": {},
      "enabledMcpjsonServers": [],
      "disabledMcpjsonServers": [],
      "hasTrustDialogAccepted": false,
      "projectOnboardingSeenCount": 0,
      "hasClaudeMdExternalIncludesApproved": false,
      "hasClaudeMdExternalIncludesWarningShown": false
    }
  },
  "hasCompletedOnboarding": true
}
  1. Restart claude and the issue is gone.

Hope this could help!

dex1n avatar Jul 24 '25 09:07 dex1n

i also see this error in linux server thanks to @dex1n ! Following your nice suggestion, i add the below line into the .claude.json and it works! "hasCompletedOnboarding": true

yu-liu24 avatar Aug 04 '25 07:08 yu-liu24

I experienced the same issue on my Mac and finally found this solution worked for me:

  1. Open your .claude.json in your home folder;
  2. Add the below line into the json and save;
"hasCompletedOnboarding": true

The complete json after the modification would look like:

{
  "installMethod": "unknown",
  "autoUpdates": true,
  "userID": "[your_user_id]",
  "firstStartTime": "[time]",
  "projects": {
    "/Users/[your_home_folder]": {
      "allowedTools": [],
      "history": [],
      "mcpContextUris": [],
      "mcpServers": {},
      "enabledMcpjsonServers": [],
      "disabledMcpjsonServers": [],
      "hasTrustDialogAccepted": false,
      "projectOnboardingSeenCount": 0,
      "hasClaudeMdExternalIncludesApproved": false,
      "hasClaudeMdExternalIncludesWarningShown": false
    }
  },
  "hasCompletedOnboarding": true
}
  1. Restart claude and the issue is gone.

Hope this could help!

thx Following your nice suggestion, i add the below line into the .claude.json and it works!

dx0611 avatar Aug 08 '25 01:08 dx0611

"hasCompletedOnboarding": true

This works. I was able to fix the error after adding this line.

KeanePutraSetiawan avatar Aug 08 '25 06:08 KeanePutraSetiawan

我在我的 Mac 上遇到了同样的问题,最后发现这个解决方案对我有用:

  1. 在您的主文件夹中打开您的.claude.json;
  2. 将以下行添加到 json 中并保存;
"hasCompletedOnboarding": true

修改后的完整json如下:

{
  "installMethod": "unknown",
  "autoUpdates": true,
  "userID": "[your_user_id]",
  "firstStartTime": "[time]",
  "projects": {
    "/Users/[your_home_folder]": {
      "allowedTools": [],
      "history": [],
      "mcpContextUris": [],
      "mcpServers": {},
      "enabledMcpjsonServers": [],
      "disabledMcpjsonServers": [],
      "hasTrustDialogAccepted": false,
      "projectOnboardingSeenCount": 0,
      "hasClaudeMdExternalIncludesApproved": false,
      "hasClaudeMdExternalIncludesWarningShown": false
    }
  },
  "hasCompletedOnboarding": true
}
  1. 重新启动 Claude,问题就消失了。

希望这能有所帮助!

Awesome, it can also be used on Windows

Deep-Profile avatar Aug 11 '25 02:08 Deep-Profile

我在我的 Mac 上遇到了同样的问题,最后发现这个解决方案对我有用:

  1. 在您的主文件夹中打开您的.claude.json;
  2. 将以下行添加到 json 中并保存;
"hasCompletedOnboarding": true

修改后的完整json如下:

{
  "installMethod": "unknown",
  "autoUpdates": true,
  "userID": "[your_user_id]",
  "firstStartTime": "[time]",
  "projects": {
    "/Users/[your_home_folder]": {
      "allowedTools": [],
      "history": [],
      "mcpContextUris": [],
      "mcpServers": {},
      "enabledMcpjsonServers": [],
      "disabledMcpjsonServers": [],
      "hasTrustDialogAccepted": false,
      "projectOnboardingSeenCount": 0,
      "hasClaudeMdExternalIncludesApproved": false,
      "hasClaudeMdExternalIncludesWarningShown": false
    }
  },
  "hasCompletedOnboarding": true
}
  1. 重新启动 Claude,问题就消失了。

希望这能有所帮助!

Awesome, it can also be used on Windows太棒了,它也可以在 Windows 系统上使用。

问题解决了,但是后续如何使用呢,无法登入Claude code

gitchar123 avatar Nov 02 '25 15:11 gitchar123

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 10 '25 10:12 github-actions[bot]

This issue has been automatically closed due to 60 days of inactivity. If you're still experiencing this issue, please open a new issue with updated information.

github-actions[bot] avatar Jan 11 '26 10:01 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Jan 19 '26 14:01 github-actions[bot]