[Bug] LSP plugin fails to spawn npm-installed .cmd binaries on Windows
Bug Description
LSP plugin fails to spawn .cmd binaries on Windows (npm-installed language servers)
## Description
On Windows, LSP plugins (e.g., pyright-lsp, typescript-lsp) fail to spawn language server binaries that are installed via npm with .cmd extension.
## Environment
- Claude Code version: 2.1.119
- OS: Windows 10/11
- Shell: PowerShell
- Node.js installed via standard installer
- npm global directory: %APPDATA%\npm
## Reproduction Steps
1. Install Claude Code v2.1.119 on Windows
2. Install LSP plugins via /plugin install pyright-lsp@claude-plugins-official and typescript-lsp@claude-plugins-official
3. Install language server binaries via npm: npm install -g pyright typescript-language-server typescript
4. Verify binary exists: where.exe pyright-langserver.cmd returns C:\Users\<user>\AppData\Roaming\npm\pyright-langserver.cmd
5. Try LSP hover operation in Claude Code
## Expected Behavior
LSP hover/find references/etc. should work using the .cmd binary.
## Actual Behavior
Error performing hover: ENOENT: no such file or directory, uv_spawn 'pyright-langserver'
The uv_spawn call attempts to spawn 'pyright-langserver' (without extension) but does not fall back to .cmd on Windows.
## Verification
where.exe pyright-langserver returns no output (the extensionless file is a Unix shell script, not executable on Windows).
where.exe pyright-langserver.cmd returns the correct path.
The npm install creates three files in the npm global directory:
- pyright-langserver (Unix shell script, not executable on Windows)
- pyright-langserver.cmd (Windows batch file, the working entry point)
- pyright-langserver.ps1 (PowerShell script)
Claude Code only attempts the extensionless name, which fails on Windows.
## Workarounds Tried
1. Adding %APPDATA%\npm to PATH: already in PATH
2. Restarting Claude Code session: no effect
3. Using pipx install pyright instead of npm: would work for Python only, not for TypeScript
4. Editing marketplace.json to use .cmd explicitly: works but reverts on plugin updates
## Suggested Fix
On Windows, the spawn logic should:
1. First try the extensionless command name
2. If that fails with ENOENT, automatically try with .cmd and .exe extensions (matching PATHEXT behavior)
This matches how cmd.exe and PowerShell resolve commands.
## Impact
This affects all npm-installed LSP servers on Windows (pyright, typescript-language-server, vue-language-server, etc.). Many Windows developers using Claude Code are likely affected.
Environment Info
- Platform: win32
- Terminal: windows-terminal
- Version: 2.1.119
- Feedback ID: 21be9bb2-7429-4aec-845b-4610184511b1
Errors
[{"error":"Error: LSP server plugin:pyright-lsp:pyright failed to start: ENOENT: no such file or directory, uv_spawn 'pyright-langserver'\n at start (B:/~BUN/root/src/entrypoints/cli.js:3220:22157)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-27T06:26:45.326Z"},{"error":"Error: ENOENT: no such file or directory, uv_spawn 'pyright-langserver'\n at spawn (unknown)\n at spawn (node:child_process:679:35)\n at spawn (node:child_process:14:39)\n at start (B:/~BUN/root/src/entrypoints/cli.js:3220:20693)\n at M (B:/~BUN/root/src/entrypoints/cli.js:3220:24676)\n at Y (B:/~BUN/root/src/entrypoints/cli.js:3220:29916)\n at w (B:/~BUN/root/src/entrypoints/cli.js:3220:30301)\n at call (B:/~BUN/root/src/entrypoints/cli.js:3716:5730)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-27T06:26:45.326Z"},{"error":"Error: Failed to start LSP server for file C:\\Users\\nk-qc-00\\Desktop\\nk-pms\\backend\\app\\api\\jisseki.py: ENOENT: no such file or directory, uv_spawn 'pyright-langserver'\n at Y (B:/~BUN/root/src/entrypoints/cli.js:3220:29942)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-27T06:26:45.326Z"},{"error":"Error: LSP tool request failed for hover on backend/app/api/jisseki.py: ENOENT: no such file or directory, uv_spawn 'pyright-langserver'\n at call (B:/~BUN/root/src/entrypoints/cli.js:3716:7173)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-27T06:26:45.327Z"},{"error":"Error: LSP server plugin:pyright-lsp:pyright failed to start: ENOENT: no such file or directory, uv_spawn 'pyright-langserver'\n at start (B:/~BUN/root/src/entrypoints/cli.js:3220:22157)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-27T06:35:16.996Z"},{"error":"Error: ENOENT: no such file or directory, uv_spawn 'pyright-langserver'\n at spawn (unknown)\n at spawn (node:child_process:679:35)\n at spawn (node:child_process:14:39)\n at start (B:/~BUN/root/src/entrypoints/cli.js:3220:20693)\n at M (B:/~BUN/root/src/entrypoints/cli.js:3220:24676)\n at Y (B:/~BUN/root/src/entrypoints/cli.js:3220:29916)\n at w (B:/~BUN/root/src/entrypoints/cli.js:3220:30301)\n at call (B:/~BUN/root/src/entrypoints/cli.js:3716:5730)\n at processTicksAndRejections (native:7:39)…
Note: Content was truncated.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗