LSP plugins fail on Windows: spawn ENOENT for npm global shim scripts
Bug Description
All LSP plugins (pyright-lsp, typescript-lsp, etc.) fail on Windows because Claude Code uses child_process.spawn() without shell: true to launch LSP server binaries. On Windows, npm installs global packages as shell shim scripts (.cmd/.ps1/bash), not native executables, so spawn() fails with ENOENT.
Environment
- OS: Windows 11 Enterprise 10.0.26200
- Claude Code: Latest (auto-updates enabled)
- Shell: Git Bash
- Node.js: Installed via official installer
- Pyright: 1.1.408 (npm global)
- typescript-language-server: 5.1.3 (npm global)
Reproduction
- Install pyright globally:
npm install -g pyright - Install the
pyright-lspplugin fromclaude-plugins-official - Enable LSP:
ENABLE_LSP_TOOL: "1"in settings - Use the LSP tool on any
.pyfile
On local paths:
Error performing documentSymbol: Failed to sync file open C:\...\file.py: Cannot send notification to LSP server 'plugin:pyright-lsp:pyright': server is error
On UNC paths:
Error performing documentSymbol: ENOENT: no such file or directory, uv_spawn 'pyright-langserver'
Root Cause (Confirmed)
Node.js spawn('pyright-langserver', ['--stdio']) without shell: true fails on Windows because:
pyright-langserverin npm global bin is a bash shell script shim, not a native.exepyright-langserver.cmdexists butspawn()doesn't try.cmdextensions withoutshell: true- libuv's
uv_spawncannot execute shell scripts directly
Proof: Running spawn('pyright-langserver', ['--stdio'], { shell: true }) successfully outputs "Pyright language server 1.1.408 starting".
Configuration (All Correct)
settings.json:ENABLE_LSP_TOOL: "1", plugin enabled- Marketplace
lspServers.pyrightconfig:command: "pyright-langserver",args: ["--stdio"] - Binary exists at
C:\Users\...\AppData\Roaming\npm\pyright-langserver(+.cmd,.ps1) - npm global bin is in PATH
Fix
Add shell: true to the spawn() options when launching LSP servers on Windows, or detect and use the .cmd shim directly. This affects all LSP plugins, not just pyright.
Affected Plugins
All LSP plugins in claude-plugins-official:
- pyright-lsp, typescript-lsp, clangd-lsp, csharp-lsp, gopls-lsp, jdtls-lsp, kotlin-lsp, lua-lsp, php-lsp, ruby-lsp, rust-analyzer-lsp, swift-lsp
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗