[Bug] npm Install Fails: ENOTEMPTY Error During Global Package Update

Resolved 💬 8 comments Opened Aug 30, 2025 by rschwegler Closed Sep 2, 2025

Bug Description
update problem with claude code
npm i -g @anthropic-ai/claude-code
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'

Environment Info

  • Platform: darwin
  • Terminal: iTerm.app
  • Version: 1.0.96
  • Feedback ID: 94afdf2e-5918-4f92-b2ec-159a64883765

Errors

[{"error":"Error: Failed to install new version of claude:  npm error code ENOTEMPTY\nnpm error syscall rename\nnpm error path /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code\nnpm error dest /opt/homebrew/lib/node_modules/@anthropic-ai/.claude-code-2DTsDk1V\nnpm error errno -66\nnpm 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'\nnpm error A complete log of this run can be found in: /Users/robert.schwegler/.npm/_logs/2025-08-30T08_04_35_594Z-debug-0.log\n    at l31 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1635:392)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3555:10962","timestamp":"2025-08-30T08:04:35.926Z"},{"error":"Error: Failed to install new version of claude:  npm error code ENOTEMPTY\nnpm error syscall rename\nnpm error path /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code\nnpm error dest /opt/homebrew/lib/node_modules/@anthropic-ai/.claude-code-2DTsDk1V\nnpm error errno -66\nnpm 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'\nnpm error A complete log of this run can be found in: /Users/robert.schwegler/.npm/_logs/2025-08-30T08_04_39_796Z-debug-0.log\n    at l31 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1635:392)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3555:10962","timestamp":"2025-08-30T08:04:40.142Z"},{"error":"Error: Failed to install new version of claude:  npm error code ENOTEMPTY\nnpm error syscall rename\nnpm error path /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code\nnpm error dest /opt/homebrew/lib/node_modules/@anthropic-ai/.claude-code-2DTsDk1V\nnpm error errno -66\nnpm 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'\nnpm error A complete log of this run can be found in: /Users/robert.schwegler/.npm/_logs/2025-08-30T08_05_08_241Z-debug-0.log\n    at l31 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1635:392)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3555:10962","timestamp":"2025-08-30T08:05:08.641Z"},{"error":"Error: Failed to install new version of claude:  npm error code ENOTEMPTY\nnpm error syscall rename\nnpm error path /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code\nnpm error dest /opt/homebrew/lib/node_modules/@anthropic-ai/.claude-code-2DTsDk1V\nnpm error errno -66\nnpm 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'\nnpm error A complete log of this run can be found in: /Users/robert.schwegler/.npm/_logs/2025-08-30T08_05_11_570Z-debug-0.log\n    at l31 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1635:392)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:3555:10962","timestamp":"2025-08-30T08:05:11.886Z"}]

View original on GitHub ↗

This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗