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

相关推荐
aiks_yuan16 小时前
Obsidian安装使用教程:核心插件配置与图片自动上传、Claude Code插件实战
claude
码哥字节19 小时前
大厂程序员写 AI 编程半年来,我的 3 次认知推翻与 1 次生存顿悟
ai编程·claude
一缕82年的清风1 天前
当团队全员都在用 Coding Agent:为什么生产环境代码通胀与架构债务反而激增了?
chatgpt·claude
独隅2 天前
Claude API 实战教程:从入门到完整项目
android·java·数据库·claude·claude code
独隅2 天前
Claude 高效使用指南与效果展示
claude·claude code
ZzT2 天前
Claude Duet 安全设计拆解:替你回邮件、付账单的 agent,碰不到你的密码
ai编程·claude
小七-七牛开发者2 天前
当 Agent 接手更多工作,我们还能把好关吗?
ai·openai·agent·claude
独隅2 天前
Claude 高效使用指南深度评测
java·开发语言·claude·claude code
yjm0022 天前
如何用 Claude Opus 5.5 做一支音乐 MV?代码逐帧渲染完整教程(2026)
ai编程·claude