akinnya

导航

Claude command not found 解决方法

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

终端输入 claude 出现
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:
  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. 成功

posted on 2025-12-04 14:33  akinnya  阅读(0)  评论(0)    收藏  举报