[Windows Bug] TypeScript LSP Plugin fails with ENOENT - spawn without shell:true
Bug Report: TypeScript LSP Plugin fails to start on Windows (spawn typescript-language-server ENOENT)
๐ Summary
The typescript-lsp@claude-plugins-official plugin fails to start on Windows with error spawn typescript-language-server ENOENT, even when the package is correctly installed globally via npm.
๐ Issue Description
When running /doctor in Claude Code on Windows, the TypeScript LSP plugin consistently fails to start with the error:
Error: LSP server plugin:typescript-lsp:typescript failed to start: spawn typescript-language-server ENOENT
This occurs despite:
- โ
typescript-language-serverbeing correctly installed globally (npm list -g) - โ The executable being present in the system PATH
- โ The executable working correctly when invoked from the command line
๐ Steps to Reproduce
- Environment Setup:
- OS: Windows 11 (build 10.0.26200.7462)
- Node.js: v22.17.0
- npm: 11.6.3
- Claude Code: Latest version (as of 2026-01-12)
- Install TypeScript Language Server:
``bash``
npm install -g typescript-language-server typescript
- Verify Installation:
```bash
# Verify package is installed
npm list -g typescript-language-server
# Output: typescript-language-server@5.1.3
# Verify executable exists
where typescript-language-server
# Output:
# C:\Users\<user>\AppData\Roaming\npm\typescript-language-server
# C:\Users\<user>\AppData\Roaming\npm\typescript-language-server.cmd
# Verify it works from command line
typescript-language-server --version
# Output: 5.1.3
```
- Enable Plugin in Claude Code:
- Edit
~/.claude/settings.json:
``json``
{
"enabledPlugins": {
"typescript-lsp@claude-plugins-official": true
}
}
- Restart Claude Code and run
/doctor:
- Error appears consistently
โ ๏ธ Actual Behavior
Claude Code fails to spawn the TypeScript language server process with ENOENT error.
Debug logs (~/.claude/debug/<latest>.txt):
2026-01-12T15:40:24.250Z [ERROR] Error: LSP server plugin:typescript-lsp:typescript failed to start: spawn typescript-language-server ENOENT
2026-01-12T15:40:24.251Z [ERROR] Error: spawn typescript-language-server ENOENT
2026-01-12T15:40:24.251Z [ERROR] Error: Failed to start LSP server plugin:typescript-lsp:typescript: spawn typescript-language-server ENOENT
โ Expected Behavior
The TypeScript LSP plugin should start successfully and provide IntelliSense features for TypeScript/JavaScript files.
๐ Root Cause Analysis
After extensive investigation, I identified the root cause:
The issue is that typescript-language-server cannot be executed using Node.js spawn() without the shell: true option on Windows.
Technical Details:
- On Windows, npm global executables are
.cmdwrapper files:
``bash``
# The actual executable is a CMD script:
C:\Users\<user>\AppData\Roaming\npm\typescript-language-server.cmd
- Node.js
spawn()withoutshell: truecannot execute.cmdfiles:
```javascript
// This FAILS on Windows:
const { spawn } = require('child_process');
spawn('typescript-language-server', ['--version']);
// Error: spawn typescript-language-server ENOENT
// This WORKS on Windows:
spawn('typescript-language-server', ['--version'], { shell: true });
// Output: 5.1.3
```
- Reproduction in Node.js:
```bash
# Fails (without shell)
node -e "const {spawn} = require('child_process'); const proc = spawn('typescript-language-server', ['--version']); proc.on('error', (err) => console.error('Error:', err.message));"
# Output: Error: spawn typescript-language-server ENOENT
# Works (with shell: true)
node -e "const {spawn} = require('child_process'); const proc = spawn('typescript-language-server', ['--version'], {shell: true}); proc.stdout.on('data', (data) => console.log(data.toString()));"
# Output: 5.1.3
```
Why This Happens:
- On Unix systems, npm creates symlinks to Node.js scripts, which are directly executable
- On Windows, npm creates
.cmdwrapper scripts that require the Windows shell to execute - Claude Code appears to spawn LSP servers without the
shell: trueoption, which works on Unix but fails on Windows
๐ ๏ธ Workaround Applied
Temporary solution: Disable the TypeScript LSP plugin
Edit ~/.claude/settings.json:
{
"enabledPlugins": {
"typescript-lsp@claude-plugins-official": false
}
}
Impact: Claude Code continues to work normally for TypeScript files (read/write/edit), but without LSP-powered IntelliSense features.
๐ก Suggested Fix
Update the LSP server spawning logic in Claude Code to use shell: true on Windows:
// Proposed fix in Claude Code's LSP spawning logic:
const isWindows = process.platform === 'win32';
const lspProcess = spawn(serverCommand, serverArgs, {
shell: isWindows, // Add this option for Windows
stdio: ['pipe', 'pipe', 'pipe'],
// ... other options
});
Alternatively, use a cross-platform approach:
const { spawn } = require('child_process');
const { spawnServer } = require('some-cross-platform-spawn-library');
// Or detect .cmd/.bat extensions and use shell accordingly
const needsShell = process.platform === 'win32' &&
(serverCommand.endsWith('.cmd') || serverCommand.endsWith('.bat'));
const lspProcess = spawn(serverCommand, serverArgs, {
shell: needsShell,
// ... other options
});
๐ Environment Information
- OS: Windows 11 (version 10.0.26200.7462)
- Node.js: v22.17.0
- npm: 11.6.3
- TypeScript: 5.9.3
- typescript-language-server: 5.1.3
- Claude Code: [Version - please check via
/versionor help menu] - Shell: Git Bash (also tested in PowerShell and CMD - same issue)
๐ Additional Information
Other plugins affected: This issue likely affects all plugins that spawn Node.js executables installed via npm on Windows, not just TypeScript LSP.
Related issues:
- Similar issues might exist for other language servers (ESLint, Prettier, etc.)
- Any npm global package that Claude Code tries to spawn would have this issue
๐ Request
Could you please:
- Add
shell: truewhen spawning processes on Windows - Consider using a cross-platform process spawning library that handles this automatically
- Add error handling that provides more helpful error messages (e.g., "Failed to spawn LSP server. On Windows, ensure the executable is in PATH and npm is properly configured.")
๐ References
- Node.js
child_process.spawn()documentation: https://nodejs.org/api/child_process.html#child_processspawncommand-args-options - Stack Overflow discussion on Windows spawn ENOENT: https://stackoverflow.com/questions/37459717/error-spawn-enoent-on-windows
- npm executable wrapper behavior on Windows: https://github.com/npm/cli/blob/latest/lib/utils/cmd-shim.js
---
Thank you for maintaining Claude Code! This is a fantastic tool, and I'm confident this fix will improve the Windows experience significantly. ๐
Let me know if you need any additional information or logs!
This issue has 4 comments on GitHub. Read the full discussion on GitHub โ