[BUG] Native installer writes malformed PATH entry on Windows (C\Users\... instead of C:\Users\...)

Status Open
Reported on v2.1.150
Maintainer reply None cached
Activity 0 comments · opened Aug 3, 2026

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

The native installer (install.ps1) writes a malformed PATH entry for the user environment variable.
It registers:

C\Users\{USERNAME}\.local\bin

instead of the correct absolute Windows path:

C:\Users\{USERNAME}\.local\bin

The colon (:) after the drive letter C is missing, turning an absolute path into a relative path.

Root Cause (Hypothesis)

The installer script likely builds the PATH string using string interpolation or concatenation
that drops the : from the drive letter. A possible cause is incorrect escaping or splitting
on : when reading or modifying the existing PATH value, stripping the drive delimiter.

Suspect location in install.ps1:

# Potentially incorrect
$installPath = "C\Users\$env:USERNAME\.local\bin"

# Should be
$installPath = "C:\Users\$env:USERNAME\.local\bin"
# or better
$installPath = Join-Path $env:USERPROFILE ".local\bin"

Using Join-Path with $env:USERPROFILE would be the idiomatic and safe fix,
as it handles drive letters and separators correctly on any Windows configuration.

What Should Happen?

Expected Behavior

  • The installer writes C:\Users\{USERNAME}\.local\bin (with colon) to the User PATH
  • claude --version works immediately after opening a new terminal session
  • No spurious folder structures are created in project directories

Error Messages/Logs

Steps to Reproduce

Steps to Reproduce

  1. Run the native installer on a fresh Windows machine:

``powershell
irm https://claude.ai/install.ps1 | iex
``

  1. After installation completes, inspect the user PATH:

``powershell
[System.Environment]::GetEnvironmentVariable("PATH", "User") -split ';' |
Where-Object { $_ -like '*\.local\bin*' }
``

  1. Observe the malformed entry:

``
C\Users\{USERNAME}\.local\bin ← missing colon after C
``

  1. Open a new terminal session and run:

``powershell
claude --version
``

  1. Observe the error:

``
claude command is missing or invalid at C\Users\{USERNAME}\.local\bin\claude.exe
``

Claude Model

_No response_

Is this a regression?

No, this never worked

Last Working Version

<2.1.150

Claude Code Version

2.1.220 (Claude Code)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Actual Behavior

  • The installer reports success and confirms the binary location as C:\Users\{USERNAME}\.local\bin\claude.exe
  • However, the PATH entry written to the Windows User Environment is C\Users\{USERNAME}\.local\bin (no colon)
  • Windows treats this as a relative path, causing:
  • claude command not found in new terminal sessions
  • A literal folder structure C\Users\{USERNAME}\.local\bin\ being created inside whatever the current working directory is when claude is invoked
  • The installer warning: "Native installation exists but C\Users\arisc\.local\bin is not in your PATH"
⚠ Setup notes:
  ● Native installation exists but C\Users\{USERNAME}\.local\bin is not in your PATH.
    Add it by opening: System Properties → Environment Variables → Edit User PATH →
    New → Add the path above. Then restart your terminal.

Note: The warning itself also shows the malformed path, confirming the bug originates inside the installer logic.

Workaround

Manually fix the PATH entry via PowerShell:

# Read current user PATH
$userPath = [System.Environment]::GetEnvironmentVariable("PATH", "User")

# Remove malformed entry, add correct one, deduplicate
$correctPath = "C:\Users\$env:USERNAME\.local\bin"
$entries = ($userPath -split ';' | Where-Object { $_ -ne "C\Users\$env:USERNAME\.local\bin" })
$entries += $correctPath
$cleanEntries = $entries | Select-Object -Unique

# Save corrected PATH
[System.Environment]::SetEnvironmentVariable("PATH", ($cleanEntries -join ';'), "User")

Then close and reopen the terminal. Run claude --version to confirm it resolves correctly.

Optionally, clean up the spurious folder created by the bug:

# Remove the relative folder structure created in the user home or project directories
Remove-Item -Recurse -Force "$env:USERPROFILE\C" -ErrorAction SilentlyContinue

Suggested Fix

In install.ps1, replace any hardcoded or interpolated path construction with:

$installDir = Join-Path $env:USERPROFILE ".local\bin"

And when appending to PATH, prefer:

$currentPath = [System.Environment]::GetEnvironmentVariable("PATH", "User")
if ($currentPath -notlike "*$installDir*") {
    [System.Environment]::SetEnvironmentVariable(
        "PATH",
        "$currentPath;$installDir",
        "User"
    )
}

---

Additional Notes

  • The binary itself is installed correctly at C:\Users\{USERNAME}\.local\bin\claude.exe
  • claude doctor confirms the correct path when run via full absolute path
  • The bug survives reinstallation — running the installer again does not fix the PATH entry
  • Reproduced on two consecutive install attempts (versions 2.1.150 and 2.1.220)

View original on GitHub ↗