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!。

相关推荐
冬奇Lab1 小时前
每日一个开源项目(第138篇):OpenMontage - 把 AI 编程助手变成完整的视频制作团队
人工智能·开源·claude
程序员辉哥4 小时前
Skill精通系列之GStack-最会做决策的虚拟团队
openai·ai编程·claude
浩风祭月5 小时前
Cursor + Claude Code实战:从需求分析到测试提交的完整流程
ai编程·claude·cursor
乘风gg11 小时前
还在养虾吗?虾王已诞生:微信龙虾 ClawBot
前端·ai编程·claude
ZzT13 小时前
Claude Code Agent teams vs Codex multi-agent v2 机制对比
ai编程·claude
武子康13 小时前
调查研究-187 Claude Fable 5 / Mythos 5 事件:前沿模型开始进入“能力分层”时代
人工智能·openai·claude
乘风gg1 天前
为什么AI 时代来临,大部分人吃不到红利
前端·ai编程·claude
Java_慈祥1 天前
手把手 教你,Claude + CC-Switch 使用!!
ai编程·claude·敏捷开发
HLeiDev1 天前
hl-research 拆解:一个“先问对问题“的调研工具,和它七版迭代里的取舍
claude