claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Windows installer reports success but fails to create claude.exe in target directory

Open codywilliamson opened this issue 3 weeks ago • 8 comments

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?

Summary

The Windows PowerShell installer script (install.ps1) reports successful installation but fails to actually create the claude.exe file in the target directory C:\Users\<username>\.local\bin\.

Environment

  • OS: Windows 11 Pro (Build 10.0.26200)
  • PowerShell Version: 7.5.4
  • Claude Code Version: 2.0.67
  • Installation Method: PowerShell script via irm https://claude.ai/install.ps1 | iex

Root Cause Analysis

After examining the installer script, the issue appears to be in this flow:

  1. Script downloads claude.exe to temporary location: $env:USERPROFILE\.claude\downloads\claude-$version-$platform.exe
  2. Script runs & $binaryPath install to set up the launcher
  3. The install subcommand reports success but fails to create the executable
  4. Script deletes the temporary file in the finally block

When running the installer manually:

$GCS_BUCKET = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases"
$version = Invoke-RestMethod -Uri "$GCS_BUCKET/stable"
$platform = "win32-x64"
$downloadPath = "$env:USERPROFILE\Downloads\claude-installer.exe"
Invoke-WebRequest -Uri "$GCS_BUCKET/$version/$platform/claude.exe" -OutFile $downloadPath

& $downloadPath install stable

It produces the same "successfully installed" message but does not actually create the file at the reported location.

Directory Permissions

Permissions are correct and allow full control:

Path   : C:\Users\Cody\.local\bin
Owner  : BUILTIN\Administrators
Access : NT AUTHORITY\SYSTEM Allow  FullControl
         BUILTIN\Administrators Allow  FullControl
         COMPUTERNAME\Cody Allow  FullControl

Workaround

Manual installation works:

# Download the installer
$GCS_BUCKET = "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases"
$version = Invoke-RestMethod -Uri "$GCS_BUCKET/stable"
$platform = "win32-x64"
$downloadPath = "$env:USERPROFILE\Downloads\claude-installer.exe"
Invoke-WebRequest -Uri "$GCS_BUCKET/$version/$platform/claude.exe" -OutFile $downloadPath

# Manually copy to target location
New-Item -ItemType Directory -Force -Path "C:\Users\$env:USERNAME\.local\bin"
Copy-Item $downloadPath "C:\Users\$env:USERNAME\.local\bin\claude.exe"

# Add C:\Users\<username>\.local\bin to PATH manually through System Properties

What Should Happen?

The claude.exe file should be created at C:\Users\Cody.local\bin\claude.exe` and be executable.

Actual Behavior

  • The installer reports "✔ Claude Code successfully installed!"
  • The installer reports the location as C:\Users\Cody\.local\bin\claude.exe
  • The installer warns that "claude command not found at C:\Users\Cody.local\bin\claude.exe"
  • The directory C:\Users\Cody\.local\bin\ exists but is empty (or does not contain claude.exe)
  • Running claude fails with "command not found"

Error Messages/Logs


Steps to Reproduce

  1. Run the installer:

    irm https://claude.ai/install.ps1 | iex
    
  2. Observe the output:

    Setting up Claude Code...
    ✔ Claude Code successfully installed!
      Version: 2.0.67
      Location: C:\Users\Cody\.local\bin\claude.exe
      Next: Run claude --help to get started
    ⚠ Setup notes:
      • installMethod is native, but claude command not found at C:\Users\Cody\.local\bin\claude.exe
      • Native installation exists but C:\Users\Cody\.local\bin is not in your PATH.
    
  3. Check the directory:

    Get-ChildItem C:\Users\Cody\.local\bin\
    

    Result: Directory is empty

  4. Verify file doesn't exist:

    Test-Path "C:\Users\Cody\.local\bin\claude.exe"
    

    Result: False

Claude Model

None

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

--

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

  • This appears to be a bug in the claude.exe install subcommand itself, not the PowerShell wrapper script
  • The issue affects the native Windows installation method
  • The installer provides misleading success feedback when the operation actually failed

codywilliamson avatar Dec 21 '25 04:12 codywilliamson

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/14902
  2. https://github.com/anthropics/claude-code/issues/9281
  3. https://github.com/anthropics/claude-code/issues/9238

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

github-actions[bot] avatar Dec 21 '25 04:12 github-actions[bot]

& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) latest

this worked for me in powershell

meesp123 avatar Dec 21 '25 14:12 meesp123

Root Cause Analysis

I debugged this issue and found the specific cause in the native installer's version check logic.

Debug Log Evidence

From ~\.claude\debug\latest after running the installer:

Install: Calling installLatest(force=true, target=stable, forceReinstall=false)
Checking for native installer update to version 2.0.67
Already running version 2.0.67 - no update needed
Install: installLatest returned version=2.0.67, wasUpdated=true, lockFailed=false
Install: Setup message: installMethod is native, but claude command not found at C:\Users\chris\.local\bin\claude.exe

The Bug

The installer's logic appears to be:

if (runningVersion == targetVersion) → skip installation

But it should be:

if (targetBinaryExists AND runningVersion == targetVersion) → skip installation
else → copy self to target location

The installer correctly detects that it's running version 2.0.67 and the target is 2.0.67 (stable), so it says "no update needed" and skips copying itself to the target directory. But it never checks whether the target file actually exists first.

Reproduction Sequence

  1. PowerShell script downloads claude.exe to ~\.claude\downloads\claude-2.0.67-win32-x64.exe
  2. Runs & $binaryPath install stable
  3. The binary checks its own version (2.0.67) vs target (stable = 2.0.67)
  4. Versions match → skips copying to ~\.local\bin\claude.exe
  5. PowerShell script deletes the temp file
  6. Result: No binary at target location

Workaround

Manually download the binary directly to the target location:

$ProgressPreference = 'SilentlyContinue'
New-Item -ItemType Directory -Force -Path "$env:USERPROFILE\.local\bin" | Out-Null
Invoke-WebRequest -Uri "https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/2.0.67/win32-x64/claude.exe" -OutFile "$env:USERPROFILE\.local\bin\claude.exe"
& "$env:USERPROFILE\.local\bin\claude.exe" install

Suggested Fix

In the native installer's installLatest function, before checking version match, first verify that the target binary exists at ~\.local\bin\claude.exe. If it doesn't exist, always perform the copy regardless of version.

chrisbyboston avatar Dec 21 '25 20:12 chrisbyboston

This is a duplicate of #14902

cjpeterein avatar Dec 23 '25 19:12 cjpeterein

Hi, I faced this issue on PowerShell So i tried the installation with CMD : curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd and it works

sofiane3106 avatar Dec 27 '25 00:12 sofiane3106

Windows Native Installation Fix Workaround

[!WARNING] Before running: This script will force-close all running Claude Code processes and uninstall existing Claude installations before reinstalling. Save your work and close Claude Code first. Run at your own risk.

Quick Fix (PowerShell) - No Download Needed

& ([scriptblock]::Create((irm https://claude.ai/install.ps1))) latest

Full Installer Script

View source on GitHub Gist

PowerShell

irm https://gist.githubusercontent.com/fatihaziz/6b6f68e9b5cd2fd7763591f25d97ea54/raw/claude_installer.py -OutFile $env:TEMP\ci.py; python $env:TEMP\ci.py --native-only

Bash / Git Bash / Cygwin

curl -fsSL https://gist.githubusercontent.com/fatihaziz/6b6f68e9b5cd2fd7763591f25d97ea54/raw/claude_installer.py | python - --native-only

Why It Works

The latest argument bypasses the version-check bug in claude.exe install (#14942).

Root cause: The installer checks if runningVersion == targetVersion and skips copying the binary - but doesn't verify the target file actually exists.

What The Script Does

  1. Force-closes all running Claude Code processes
  2. Uninstalls existing Claude installations (npm, bun, deno, native)
  3. Downloads Claude binary directly from GCS bucket
  4. Verifies SHA256 checksum
  5. Runs claude.exe install latest (bypasses the bug)
  6. Verifies installation

Requirements

  • Python 3.6+
  • curl (included in Windows 10+)
  • Internet connection

fatihaziz avatar Dec 27 '25 21:12 fatihaziz