LSP plugins can't spawn npm-installed binaries on Windows (POSIX shell shims)
Problem
When an LSP plugin's .lsp.json specifies a command that was installed via npm install -g (e.g., intelephense), Claude Code fails to launch the language server on Windows.
The root cause: npm global installs on Windows create three files per binary:
intelephense- a POSIX shell script (#!/bin/sh)intelephense.cmd- a Windows batch wrapperintelephense.ps1- a PowerShell wrapper
Claude Code appears to resolve and spawn the POSIX shell script, which doesn't execute natively on Windows. The .cmd or .ps1 wrapper would work, but Claude Code doesn't try those.
This is related to #27220 (LSP plugins not receiving workspace root) - both are LSP plugin infrastructure issues. See also anthropics/claude-plugins-official#444 (php-lsp stub) and anthropics/claude-plugins-official#441 (lua-lsp stub).
Observed behavior
.lsp.jsonspecifies"command": "intelephense"with"args": ["--stdio"]intelephenseis installed globally via npm and is in PATH- Claude Code resolves it to the POSIX shell script shim
- The language server never starts, no diagnostics are produced
Expected behavior
Claude Code should either:
- Prefer
.cmdextensions when resolving commands on Windows, or - Use
cmd /corprocess.spawnwithshell: trueto let Windows resolve the correct wrapper, or - Detect POSIX shims and invoke
nodewith the target.jsfile directly
Workaround
In the plugin's .lsp.json, use intelephense.cmd instead of intelephense:
{
"php": {
"command": "intelephense.cmd",
"args": ["--stdio"],
"extensionToLanguage": {
".php": "php"
}
}
}
This works because the .cmd wrapper executes natively on Windows. A replacement plugin with this fix: https://github.com/SSyl/claude-win-lsps
Note: this affects any npm-installed LSP server, not just Intelephense. Any .lsp.json pointing at an npm binary will hit this on Windows.
Environment
- Windows 11
- Claude Code (latest)
- Node.js via nvm4w
- Intelephense 1.13.1 (npm global)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗