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

相关推荐
ZhengEnCi19 小时前
AI 规则越多越费 Token:无关规则让每次回答多耗 46% 的规则体检提示词
aigc·ai编程·claude
ServBay20 小时前
连AI自己也不愿意维护自己的屎山代码
后端·ai编程·claude
jerrywus1 天前
用 AMD Radeon Cloud 免费跑 ComfyUI:从开机到打开界面
前端·agent·claude
Michaelyeung1 天前
Windows 上给 Claude Code 配 MCP,今天踩的 3 个坑,你看看你在不在坑里
claude
ZzT1 天前
三个 Claude 代码审查 skill 用了半年、1,306 条评论:最简单的修复率 68.9%,最复杂的 59.2%
ai编程·claude
一缕82年的清风1 天前
告别手动搬砖!我是如何搭出一套“AI 全自动自媒体运营系统”,每天 10 分钟铺满 7 大平台的?
chatgpt·claude·gemini
stark张宇2 天前
Vibe Coding 入门实战:用 Claude Code 跑通 AI 产品开发流程(上)
后端·claude·vibecoding
武子康2 天前
ComfyUI 加载了动作 LoRA,H3-World 的时间绑定就接好了吗?
人工智能·机器学习·claude
ZzT2 天前
Claude Code 连续压缩 3 次,丢掉 33% 到 57% 的用户指令;/compact 后加一段提示词降到 0
ai编程·claude
threerocks2 天前
Fable 5.2 完整大师课:这些提示词会彻底改变你
claude