报错字典 / Claude Code / ETIMEDOUT / Update

启动时自动检查更新 ETIMEDOUT 导致卡顿 30 秒

CLI 启动时默认联网探测 npm 官方源最新版本,国内网络超时引发启动龟速。

原始报错与特征码

2026-11-08
npm error code ETIMEDOUT npm error syscall connect npm error errno ETIMEDOUT npm error address 104.16.25.34:443 (registry.npmjs.org update check timed out after 30000ms)

根本原因分析

Claude Code 每次在终端唤起时,会在后台异步请求 https://registry.npmjs.org/@anthropic-ai/claude-code 获取最新版本号。在无代理或国内直连环境下,该握手会在 30 秒超时后才放弃并进入正常命令行。

可复制解法与生产配置

  1. 配置终端镜像源:npm config set registry https://registry.npmmirror.com;
  2. 在环境变量中注入 DISABLE_AUTO_UPDATER=1 跳过启动时的版本探活检测;
  3. 使用 AllAgent 桌面助手,已全局预置离线优化与国内高速镜像加速。