Bug: Windows 预编译版本缺少 `@anthropic-ai/claude-agent-sdk` 依赖
问题描述
Windows 预编译版本(v0.13.2)的打包产物中缺少 @anthropic-ai/claude-agent-sdk 包,导致应用启动时报错无法运行。
错误信息
Error: Claude Code executable not found at C:\Users{用户名}\AppData\Local\Programs\CodePilot\resources\standalone\node _modules@anthropic-ai\claude-agent-sdk\cli.js. Is options.pathToClaudeCodeExecutable set?
环境信息
- 操作系统: Windows 11
- CodePilot 版本: 0.13.2
- 安装方式: GitHub Releases 下载的 NSIS 安装包
根本原因
预编译包中的 resources/standalone/node_modules/ 目录没有包含 @anthropic-ai/claude-agent-sdk。查看该目录结构:
resources/standalone/node_modules/ ├── @img/ ├── @next/ ├── @opentelemetry/ ├── @shikijs/ ├── @swc/ ├── better-sqlite3/ ├── ... (其他包) └── (缺少 @anthropic-ai/)
临时解决方案
手动安装缺失的依赖:
cd "C:\Users\{用户名}\AppData\Local\Programs\CodePilot\resources\standalone"
npm install @anthropic-ai/claude-agent-sdk
然后重启应用即可正常运行。
建议修复
请在 electron-builder 打包过程中确保 @anthropic-ai/claude-agent-sdk 被正确打包。可能需要检查构建脚本或
electron-builder 配置,确保所有生产依赖都被包含在最终产物中。
补充信息
- package.json 中已声明 @anthropic-ai/claude-agent-sdk: ^0.2.33 作为依赖
- 该 SDK 的 cli.js 文件(约 12MB)是运行时必需的
以上信息为claude code定位并生成的报告
你好!感谢你详细的 bug 报告和分析。
这个问题在 v0.13.2 之后的版本中已经修复了 —— 构建脚本已确保 @anthropic-ai/claude-agent-sdk 被正确打包到产物中。请更新到最新版本(v0.25.1),该问题应已不存在。
如果更新后仍有类似问题,请重新反馈。