[Windows] claude update (npm global) reports success but leaves 500-byte placeholder claude.exe: 'not a valid application for this OS platform'

Status Open
Reported on v2.1.276
Maintainer reply None cached
Activity 0 comments · opened Sep 23, 2026

Summary

On Windows, claude update on an npm-global install reports success but leaves bin\claude.exe as the 500-byte placeholder script. After that every claude command fails with:

Program 'claude.exe' failed to run: An error occurred trying to start process
'%APPDATA%\npm\node_modules\@anthropic-ai\claude-code\bin\claude.exe' ...
The specified executable is not a valid application for this OS platform.

Environment

  • Windows 11 Pro 10.0.26200, x64
  • Claude Code npm global install (npm i -g @anthropic-ai/claude-code), 2.1.276 → 2.1.280
  • A native install also exists on the same machine
  • PowerShell 7

What happens

  1. Several Claude Code sessions are running from the npm copy of claude.exe.
  2. Run claude update. The output ends with:

``
Successfully updated from 2.1.276 to version 2.1.280
``

  1. The next claude command fails with the error above.

bin\claude.exe is now a 500-byte text file, not a PE executable:

echo "Error: claude native binary not installed." >&2
...
echo "Run the postinstall manually (adjust path for local vs global install):" >&2
echo "  node node_modules/@anthropic-ai/claude-code/install.cjs" >&2

npm left a staging directory behind at node_modules\@anthropic-ai\.claude-code-XXXXXXXX. npm config is default (ignore-scripts=false, omit=[]), so the placeholder wasn't left by --ignore-scripts or --omit=optional.

Likely cause

On Windows, npm can't replace or delete an .exe that a running process has loaded. The update runs from the npm claude.exe it is replacing, and other sessions may hold it too. So the package swap or the install.cjs postinstall doesn't complete, and the placeholder stays in place. claude update doesn't check the result, so it reports success.

Workaround

cd %APPDATA%\npm\node_modules\@anthropic-ai\claude-code
node install.cjs

After this, claude --version works again. It can be repeated, and it breaks again on the next claude update while sessions are running.

Expected

  • claude update checks that the installed bin\claude.exe is a real executable and runs --version. If it isn't, it reports failure instead of "Successfully updated".
  • Ideally the npm path handles an in-use claude.exe on Windows the way the native installer does: rename it aside (claude.exe.old.<ts>) and write the new file in its place.
  • The "not a valid application for this OS platform" error from the placeholder gives no clue. On Windows, a placeholder that is a valid tiny .exe or .cmd could print the "run install.cjs" message instead.

View original on GitHub ↗