Skip to content

fix: add Windows Claude CLI executable paths - #18

Merged
Roasbeef merged 1 commit into
Roasbeef:mainfrom
sputn1ck:fix/windows-claude-executable-path
Jan 28, 2026
Merged

Roasbeef merged 1 commit into
Roasbeef:mainfrom
sputn1ck:fix/windows-claude-executable-path

Conversation

@sputn1ck

@sputn1ck sputn1ck commented Jan 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the "Claude Code CLI not found" error on Windows by adding Windows-specific executable paths to the search locations.

Changes

  • Added support for .local/bin/claude.exe and .cmd variants
  • Added npm global paths for Windows (AppData/Roaming/npm, AppData/Local/npm)
  • Simplified path detection by checking all OS paths universally instead of platform-specific conditionals
  • Removed unnecessary platform checks since fs.existsSync() handles non-existent paths gracefully

Test Plan

  • Tested on Windows 11 with Claude CLI installed at C:\Users\{username}\.local\bin\claude.exe
  • Plugin now successfully finds and uses the Claude executable
  • Build completes without errors

Fixes the issue where Windows users couldn't use the plugin due to Claude CLI path detection only supporting Unix-style paths.

Fixes #4

Copilot AI review requested due to automatic review settings January 16, 2026 10:33
@sputn1ck
sputn1ck force-pushed the fix/windows-claude-executable-path branch from 1099f30 to f545fb9 Compare January 16, 2026 10:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Windows compatibility for Claude CLI detection by adding Windows-specific executable paths to the search locations. The plugin previously only searched Unix-style paths, causing "Claude Code CLI not found" errors for Windows users.

Changes:

  • Added Windows executable variants (.exe, .cmd) to NVM_BIN paths
  • Added Windows-specific npm global installation directories (AppData/Roaming/npm, AppData/Local/npm)
  • Added support for .local/bin/claude.exe and .cmd variants for Windows
Comments suppressed due to low confidence (2)

src/utils/claudeExecutable.ts:1

  • The PATH separator is hardcoded as : (colon) which is Unix-specific. On Windows, the PATH separator is ; (semicolon). This will cause PATH manipulation to fail on Windows. Use path.delimiter from the Node.js path module, which automatically uses the correct separator for the current platform.
/**

src/utils/claudeExecutable.ts:58

  • The dynamic nvm detection only checks for Unix-style claude executables without extensions. On Windows with nvm-windows, the executable would be claude.cmd or claude.exe. This section needs to check for Windows variants when iterating through nvm versions to ensure Windows compatibility for nvm users.
        const claudePath = path.join(nvmDir, ver, "bin", "claude");

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +26 to +27
`${homeDir}/.local/bin/claude.exe`,
`${homeDir}/.local/bin/claude.cmd`,

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The .local/bin directory with Windows executables (.exe, .cmd) is an unusual location on Windows. Typically, npm global packages on Windows are installed to %APPDATA%\\npm or %LOCALAPPDATA%\\npm. The .local/bin directory is primarily a Unix convention. Consider verifying if Claude CLI actually installs to this location on Windows, as this may not match real-world Windows installations.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the default claude install script will install it there https://code.claude.com/docs/en/setup

`${homeDir}/.local/bin/claude.cmd`,
`${homeDir}/AppData/Roaming/npm/claude.cmd`,
`${homeDir}/AppData/Local/npm/claude.cmd`,
"C:/Program Files/nodejs/claude.cmd",

Copilot AI Jan 16, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hardcoded path uses forward slashes and assumes a specific installation location. On Windows, this should use backslashes or be constructed using path.join(). Additionally, this assumes nodejs is installed to the default location, but users may have custom installation paths. Consider using environment variables like %ProgramFiles% or removing this path if npm global paths already cover the typical installation locations.

Suggested change
"C:/Program Files/nodejs/claude.cmd",
process.env.ProgramFiles ? path.join(process.env.ProgramFiles, "nodejs", "claude.cmd") : null,

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems to work on my win machine though.

- Add support for .local/bin/claude.exe and .cmd variants
- Add npm global paths for Windows (AppData/Roaming, AppData/Local)
- Simplify path detection by checking all OS paths universally
- Fixes Claude CLI not found error on Windows systems
@sputn1ck
sputn1ck force-pushed the fix/windows-claude-executable-path branch from f545fb9 to 317d3ad Compare January 16, 2026 10:36

@Roasbeef Roasbeef left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ⚜️

@Roasbeef
Roasbeef merged commit c5c8428 into Roasbeef:main Jan 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Windows compatibility - spawn Claude CLI correctly on Windows

3 participants