[BUG] Auto-update breaks claude.exe on Windows (NVM for Windows)

Status Fixed / completed
Reported on v2.1.123
Maintainer reply ✓ Yes — claude[bot]
Activity 4 comments · opened Apr 29, 2026 · closed May 28, 2026
💡 Likely answer: A maintainer (claude[bot], contributor) responded on this thread — see the highlighted reply below.

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Bug Description

When launching claude on Windows, the auto-update process renames claude.exe to claude.exe.old.<timestamp> but fails to replace it with the new version, leaving no claude.exe in the bin directory.

Workaround

Renaming the .old file back to claude.exe restores functionality, but the issue recurs on next launch.

Environment

  • OS: Windows
  • Node: v24.15.0
  • Node manager: NVM for Windows
  • Claude Code: installed globally via npm

What Should Happen?

The auto-update should either:

  1. Successfully download and place the new claude.exe before renaming the old one
  2. Roll back to the original claude.exe if the update fails
  3. Not break the existing installation on failure

Error Messages/Logs

$ claude
/c/nvm4w/nodejs/claude: line 12: C:\nvm4w\nodejs/node_modules/@anthropic-ai/claude-code/bin/claude.exe: No such file or directory
claude
'"C:\nvm4w\nodejs\\node_modules\@anthropic-ai\claude-code\bin\claude.exe"' is not recognized as an internal or external command,
operable program or batch file.

Steps to Reproduce

  1. Install Claude Code globally via npm install -g @anthropic-ai/claude-code
  2. Run claude — works fine
  3. Close the session
  4. Run claude again — fails with:

node_modules/@anthropic-ai/claude-code/bin/claude.exe: No such file or directory

  1. Inspecting the bin directory shows only claude.exe.old.<timestamp> — no claude.exe

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.123

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

_No response_

View original on GitHub ↗

4 Comments

github-actions[bot] · 4 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/9418
  2. https://github.com/anthropics/claude-code/issues/9445
  3. https://github.com/anthropics/claude-code/issues/9436

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

MyronKoch · 3 months ago

I've hit this same issue repeatedly over several months (npm global install, not NVM — standalone Node v22.13.1 in C:\Tools). Same pattern every time: auto-updater renames claude.exe to claude.exe.old.<timestamp>, fails to copy the new binary from the platform package, wrapper script points at nothing.

Rather than disabling the auto-updater, I replaced the claude.ps1 wrapper with a self-healing version that detects the missing binary and recovers from the platform package before launching. Drop-in replacement — auto-updates stay enabled, and when the updater fails, the next launch fixes itself automatically.

Replace your claude.ps1 (wherever npm installed it) with:

#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$binExe = "$basedir\node_modules\@anthropic-ai\claude-code\bin\claude.exe"
$platformExe = "$basedir\node_modules\@anthropic-ai\claude-code\node_modules\@anthropic-ai\claude-code-win32-x64\claude.exe"

# Self-heal: if the auto-updater left claude.exe missing, recover from platform package
if (-not (Test-Path $binExe)) {
  if (Test-Path $platformExe) {
    Write-Host "[fix-claude] claude.exe missing - recovering from platform package..." -ForegroundColor Yellow
    Copy-Item $platformExe $binExe -Force
    Get-ChildItem (Split-Path $binExe) -Filter "claude.exe.old.*" -ErrorAction SilentlyContinue | Remove-Item -Force
    Write-Host "[fix-claude] Restored. Launching..." -ForegroundColor Green
  } else {
    Write-Error "[fix-claude] claude.exe missing and no platform binary found. Run: npm install -g @anthropic-ai/claude-code"
    exit 1
  }
}

if ($MyInvocation.ExpectingInput) {
  $input | & $binExe $args
} else {
  & $binExe $args
}
exit $LASTEXITCODE

And the claude.cmd equivalent:

@ECHO off
GOTO start
:find_dp0
SET dp0=%~dp0
EXIT /b
:start
SETLOCAL
CALL :find_dp0

SET "binExe=%dp0%node_modules\@anthropic-ai\claude-code\bin\claude.exe"
SET "platformExe=%dp0%node_modules\@anthropic-ai\claude-code\node_modules\@anthropic-ai\claude-code-win32-x64\claude.exe"

IF NOT EXIST "%binExe%" (
  IF EXIST "%platformExe%" (
    echo [fix-claude] claude.exe missing - recovering from platform package...
    copy /Y "%platformExe%" "%binExe%" >nul
    del /Q "%dp0%node_modules\@anthropic-ai\claude-code\bin\claude.exe.old.*" 2>nul
    echo [fix-claude] Restored. Launching...
  ) ELSE (
    echo [fix-claude] claude.exe missing and no platform binary found.
    echo Run: npm install -g @anthropic-ai/claude-code
    exit /b 1
  )
)

"%binExe%" %*

Hope this helps others until the updater is fixed properly.

claude[bot] contributor · 3 months ago

This issue was fixed as of version 2.1.153.

github-actions[bot] · 1 month ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.