npm auto-update during network outage replaces working install with 500-byte stub
Status Open
Reported on v2.1.296
Maintainer reply None cached
Workaround ✓ Mentioned in description ↑
Activity 0 comments · opened Oct 11, 2026
npm auto-update during a network outage replaces a working install with a 500-byte stub
Version: @anthropic-ai/claude-code (npm global install, ~/.npm-global), updated to 2.1.296
OS: Debian 13, Linux x86_64
What happened
The machine lost network at about 03:18. At 03:22 the auto-updater ran an npm update anyway. Afterwards:
bin/claude.exewas the 500-byte placeholder script ("Error: claude native binary not installed"), mode 664, so runningclaudefailed withPermission denied.node_modules/@anthropic-ai/claude-code-linux-x64/was left partially extracted (binary present,install.cjsreported the package as "not found").- A leftover npm staging dir
@anthropic-ai/.claude-code-dDHdXpngremained. - Remote Control stopped connecting, so the machine could not be recovered remotely.
claude was unusable until the package was reinstalled by hand.
Expected
An update that can't complete must leave the previous working version in place. A network outage should never turn a working install into one that can't start.
Suggested fixes
- Check connectivity and registry reachability before starting an update; skip it if offline.
- Install into a staging location and verify the new binary runs (
--version) before swapping it in. Roll back otherwise. - Treat a missing or failed platform optional dependency as a failed update, not a successful one.
- If the stub is ever left in place, make it executable so the user sees its instructions instead of
Permission denied.
Workaround
npm install -g @anthropic-ai/claude-code, or switch to the native installer (claude install).