[Windows Bug] TypeScript LSP Plugin fails with ENOENT - spawn without shell:true

Resolved ๐Ÿ’ฌ 4 comments Opened Jan 12, 2026 by rodrigonormandia Closed Jan 16, 2026

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-server being 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

  1. 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)
  1. Install TypeScript Language Server:

``bash
npm install -g typescript-language-server typescript
``

  1. 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
```

  1. Enable Plugin in Claude Code:
  • Edit ~/.claude/settings.json:

``json
{
"enabledPlugins": {
"typescript-lsp@claude-plugins-official": true
}
}
``

  1. 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:

  1. On Windows, npm global executables are .cmd wrapper files:

``bash
# The actual executable is a CMD script:
C:\Users\<user>\AppData\Roaming\npm\typescript-language-server.cmd
``

  1. Node.js spawn() without shell: true cannot execute .cmd files:

```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
```

  1. 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 .cmd wrapper scripts that require the Windows shell to execute
  • Claude Code appears to spawn LSP servers without the shell: true option, 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 /version or 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:

  1. Add shell: true when spawning processes on Windows
  2. Consider using a cross-platform process spawning library that handles this automatically
  3. 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

---

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!

View original on GitHub โ†—

This issue has 4 comments on GitHub. Read the full discussion on GitHub โ†—