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

相关推荐
ZzT5 小时前
同一个 skill 存了三份:多 agent 环境下的 skill 管理与两款开源工具
ai编程·claude
ZzT1 天前
拆开 Claude Code、Codex 等 11 个 coding agent:没有一个用 LangChain,也没有一个用向量检索代码
人工智能·ai编程·claude
ZzT1 天前
Agent-Reach 是什么:一句话让 AI agent 读推特、Reddit、B 站和小红书
人工智能·ai编程·claude
Maynor9962 天前
6张商品图→17秒带货短视频:开源12个Claude Skills,配音、字幕花字、BGM本地一条命令出片
ffmpeg·ai编程·claude·电商·agent skills
Patrick在香港2 天前
MCP 的 initialize 握手真的没了?67 行标准库实测 2026-07-28 规范
python·agent·claude·mcp·json-rpc
hdsrhh3 天前
在 Claude Code 中让第三方模型作为 subagent 与 Claude 协作
ai编程·claude
ZzT3 天前
Claude 干活的时候,在终端里打砖块
人工智能·ai编程·claude
VIP_CQCRE4 天前
让 Claude 实时联网搜索:Ace Data Cloud Serp MCP 接入指南
ai·claude·搜索·mcp·acedatacloud
ZzT5 天前
Claude Code Mods 是什么:给 Claude 加工具、在终端画界面
人工智能·ai编程·claude
Flynt6 天前
Claude Code 103 秒删掉 4.8 万个文件之后,我把自己的仓库"删"了一遍:git 能救的比你想的少
git·ai编程·claude