fix: add Windows Claude CLI executable paths - #18
Conversation
1099f30 to
f545fb9
Compare
There was a problem hiding this comment.
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.exeand.cmdvariants 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. Usepath.delimiterfrom 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
claudeexecutables without extensions. On Windows with nvm-windows, the executable would beclaude.cmdorclaude.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.
| `${homeDir}/.local/bin/claude.exe`, | ||
| `${homeDir}/.local/bin/claude.cmd`, |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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.
| "C:/Program Files/nodejs/claude.cmd", | |
| process.env.ProgramFiles ? path.join(process.env.ProgramFiles, "nodejs", "claude.cmd") : null, |
There was a problem hiding this comment.
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
f545fb9 to
317d3ad
Compare
Summary
Fixes the "Claude Code CLI not found" error on Windows by adding Windows-specific executable paths to the search locations.
Changes
.local/bin/claude.exeand.cmdvariantsAppData/Roaming/npm,AppData/Local/npm)fs.existsSync()handles non-existent paths gracefullyTest Plan
C:\Users\{username}\.local\bin\claude.exeFixes the issue where Windows users couldn't use the plugin due to Claude CLI path detection only supporting Unix-style paths.
Fixes #4