[BUG] Upgrades via NPM fail
Resolved 💬 2 comments Opened Aug 28, 2025 by shanetwinterhalter Closed Aug 28, 2025
Environment
- Platform (select one):
- [X] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.95
- Operating System: macOS 15.6
- Terminal: kitty
Bug Description
Updating Claude Code via NPM seems to fail. This has happened for both the 1.0.94 -> 1.0.95 & 1.0.95 -> 1.0.96 upgrades.
I've run this after being prompted with an update message within Claude code, which suggests to run npm i -g @anthropic-ai/claude-code
Running that leads to this error:
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'
To workaround, I have been manually deleting the /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code folder and re-running the npm install command which then correctly installs the update
Steps to Reproduce
- Run
npm i -g @anthropic-ai/claude-codewhen an upgraded version of claude code is available
Expected Behavior
The latest version of the package to be installed
Actual Behavior
Package upgrade fails with the error above
Additional Context
Extract from the npm install logs:
69 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-libvips-darwin-arm64@1.0.4 OK for: @img/sharp-darwin-arm64@0.33.5 want: 1.0.4
70 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-libvips-darwin-x64@1.0.4 OK for: @img/sharp-darwin-x64@0.33.5 want: 1.0.4
71 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-libvips-linux-arm@1.0.5 OK for: @img/sharp-linux-arm@0.33.5 want: 1.0.5
72 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-libvips-linux-arm64@1.0.4 OK for: @img/sharp-linux-arm64@0.33.5 want: 1.0.4
73 silly placeDep node_modules/@anthropic-ai/claude-code @img/sharp-libvips-linux-x64@1.0.4 OK for: @img/sharp-linux-x64@0.33.5 want: 1.0.4
74 silly reify mark retired [
74 silly reify '/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code',
74 silly reify '/opt/homebrew/bin/claude'
74 silly reify ]
75 silly reify moves {
75 silly reify '/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code': '/opt/homebrew/lib/node_modules/@anthropic-ai/.claude-code-2DTsDk1V',
75 silly reify '/opt/homebrew/bin/claude': '/opt/homebrew/bin/.claude-WV2akNWU'
75 silly reify }
76 verbose stack 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'
76 verbose stack at async Object.rename (node:internal/fs/promises:779:10)
76 verbose stack at async moveFile (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/fs/lib/move-file.js:30:5)
76 verbose stack at async Promise.allSettled (index 0)
76 verbose stack at async [reifyPackages] (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:325:11)
76 verbose stack at async Arborist.reify (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:142:5)
76 verbose stack at async Install.exec (/opt/homebrew/lib/node_modules/npm/lib/commands/install.js:150:5)
76 verbose stack at async Npm.exec (/opt/homebrew/lib/node_modules/npm/lib/npm.js:207:9)
76 verbose stack at async module.exports (/opt/homebrew/lib/node_modules/npm/lib/cli/entry.js:74:5)
77 error code ENOTEMPTY
78 error syscall rename
79 error path /opt/homebrew/lib/node_modules/@anthropic-ai/claude-code
80 error dest /opt/homebrew/lib/node_modules/@anthropic-ai/.claude-code-2DTsDk1V
81 error errno -66
82 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'
83 silly unfinished npm timer reify 1756407822016
84 silly unfinished npm timer reify:retireShallow 1756407822369
...
86 verbose os Darwin 24.6.0
87 verbose node v23.10.0
88 verbose npm v10.9.2
89 verbose exit -66
90 verbose code -66This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗