我是在使用cc switch管理claude key的时候突然出现的,更新node版本什么的好像也会出现这种情况,这只是最通用的方法,重装(

Claude command not found

我就直接重装claude了,记录一下步骤

  1. 先npm install -g @anthropic-ai/claude-code
  2. 然后发现报错:npm error code ENOTEMPTY npm error syscall rename npm error path /opt/homebrew/lib/node\_modules/@anthropic-ai/claude-code npm error dest /opt/homebrew/lib/node\_modules/@anthropic-ai/.claude-code-2DTsDk1V npm error errno -66 npm error ENOTEMPTY: directory not empty, rename '/opt/homebrew/lib/node\_modules/@anthropic-ai/claude-code' -> '/opt/homebrew/lib/node\_modules/@anthropic-ai/.claude-code-2DTsDk1V' npm error A complete log of this run can be found in: {redacted}
  3. 开始删除重装:sudo rm -rf /opt/homebrew/lib/node\_modules/@anthropic-ai/claude-code
  4. npm cache clean --force
  5. npm install -g @anthropic-ai/claude-code
  6. claude --version
  7. 然后就成功了
Logo

中国智能体开发者社区,聚焦智能体与大模型开发,提供前沿资讯、实用工具链、开源项目及行业案例。通过技术沙龙、开发者大赛等活动,促进经验交流与协作,助力开发者快速构建创新智能应用。

更多推荐