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

相关推荐
蓝田~10 小时前
大模型本地部署与远程调用 — 从 API 到 Agent
java·人工智能·claude·claude code
武子康16 小时前
🔥 codex-plugin-cc 原理全拆:四层桥接 + JSON-RPC 2.0 + JSONL + 后台任务状态机
人工智能·llm·claude
kyriewen1 天前
看了微软几万人用AI编程的数据——效率涨24%的代价没人提
前端·ai编程·claude
武子康2 天前
OpenAI 把 Codex 接进 Claude Code:Coding Agent 从单兵工具进入协作系统
人工智能·openai·claude
喜欢天文的2 天前
一个桌面应用,如何把 7 个 AI 编程工具全部"中间人"掉——CC Switch 深度拆解(上)
claude
洛卡卡了2 天前
Claude Code 项目级 Skill:团队协作场景下的使用场景
人工智能·后端·claude
Lazy_zheng3 天前
TDD 实战:Claude Code Superpowers 保姆级教程14 个 Skills 全解析 + 实战开发
前端·claude·vibecoding
plainGeekDev3 天前
多步流水线 + HereDoc:一条脚本完成全自动内容生产
aigc·ai编程·claude
码哥字节4 天前
spec-superflow 上手指南:6 平台安装
claude