解决Claude Code 安装报错 `Unable to connect to Anthropic services`

解决Claude Code 安装报错 Unable to connect to Anthropic services 排查

一、问题背景

最近准备体验 Claude Code,在 Windows 11 环境下安装时遇到了一个异常问题。

1、环境(我的电脑已经存在npm/node的情况):

  • Windows 11
  • Node.js v22.17.0
  • npm v10.9.2

2、命令安装claude-code

输入npm install -g @anthropic-ai/claude-code 等待完成就行


二、确认 Claude Code 是否真正安装成功

依次输入:node -vnpm -vclaude --version 如果有对应的版本信息输出,代表安装完成;


三、错误现象

启动claude

输入:claude

报错信息:

Unable to connect to Anthropic services

Failed to connect to api.anthropic.com: ECONNRESET

原因:Claude Code 已经正常启动,只是在连接 Anthropic API 时失败。

四、解决

开启VPN原因导致连接异常

1、检查本地代理端口

2、查看代理:

在终端输入以下命令,xxxx表示上面查询到的端口号

powershell 复制代码
$env:HTTPS_PROXY="http://127.0.0.1:xxxx"
$env:HTTP_PROXY="http://127.0.0.1:xxxx"

3、再次运行,结果OK

相关推荐
win4r14 小时前
🚀Orca ADE彻底改变AI编程方式!多Agent并行、语音输入、定时审查、Git Worktree自动隔离+结构化编排+面板分割布局自由调整,支持手机APP查看进度并启动任务,开发者必备效率工具!
ai编程·claude·vibecoding
uccs16 小时前
Agent 工具系统怎么设计:注册、并发锁与截断
agent·ai编程·claude
CAE虚拟与现实1 天前
AI 编程助手的语境下Fork是什么意思?
人工智能·claude·codex·豆包·deepseek
Miku162 天前
Claude Code 循环(Loops)入门:从 /goal 到 /schedule 的四种模式
agent·ai编程·claude
To_OC2 天前
再也不用手动整理会议纪要!我给 Claude 封装了一套永久自动化 Skill
人工智能·agent·claude
武子康2 天前
2026 开源视频生成模型全景图:按 9 类任务路由比按参数量选模型更可靠
人工智能·ai·chatgpt·openai·claude·世界模型·视频模型
码哥字节4 天前
Anthropic 官方的 7 种 Claude Code 自定义方式,你可能只用对了 1 种
ai编程·claude·mcp
Claude实战手记4 天前
时间口径错了,你的自动化就在系统性造假
claude