Claude CLI 安装报错记录(native binary not installed)

Claude CLI 安装报错记录(native binary not installed)

问题现象

安装 @anthropic-ai/claude-code 后执行 claude 报错:

sql 复制代码
Error: claude native binary not installed.                                    
                                                                                
  Either postinstall did not run (--ignore-scripts, some pnpm configs)          
  or the platform-native optional dependency was not downloaded                 
  (--omit=optional).                                                            
                                                                                
  Run the postinstall manually (adjust path for local vs global install):       
    node node_modules/@anthropic-ai/claude-code/install.cjs                     
                                                                                
  Or reinstall without --ignore-scripts / --omit=optional.                      

原因

npm 使用了国内 registry(如 npmmirror),该源未同步 optional binary,导致 native 依赖未下载。

排查

查看当前 npm registry

arduino 复制代码
npm config get registry

如果返回:

arduino 复制代码
https://registry.npmmirror.com

或:

arduino 复制代码
https://registry.npm.taobao.org

说明正在使用国内镜像源。

解决方法

切换官方源重新安装:

bash 复制代码
npm config set registry https://registry.npmjs.org/

npm uninstall -g @anthropic-ai/claude-code

npm install -g @anthropic-ai/claude-code

或仅本次使用官方源(推荐):

bash 复制代码
npm install -g @anthropic-ai/claude-code --registry=https://registry.npmjs.org/

验证

css 复制代码
claude --version

能正常输出版本号即可,Have a try!。

相关推荐
学心理学的程序员12 小时前
ripwire:红帽官方开源!AI 上下文界的 ripgrep,0.25 秒画完整张代码调用地图,Token 最多省几百倍
claude·skills·ripwire
plainGeekDev13 小时前
Guides vs Sensors:Harness 的双核控制框架
aigc·ai编程·claude
plainGeekDev1 天前
Harness Engineering 入门:Agent = Model + Harness
aigc·ai编程·claude
Patrick在香港1 天前
Claude 工作提醒自动化:香港天文台四个接口三个「更新时间」,警告到期了却还在生效
python·api·claude·数据抓取·香港
mmsx2 天前
Claude Code 安装配置实战:Windows 下接入 Anthropic 兼容网关与自定义模型
claude·安装教程
kyriewen2 天前
Claude Code 的额度今天缩水了17%——官方公告上写的是"永久提高25%"
前端·ai编程·claude
JudithHuang2 天前
Claude 桌面端入门:Claude Desktop + cc-switch + DeepSeek
claude·deepseek
deepseek232 天前
Claude Mythos 5越界投毒拆解:穿过CAPTCHA向PyPI投毒,82%重跑有害率背后的偏见推理与监控失效
人工智能·claude·ai agent