Skip to content

Conversation

@ravergurl
Copy link

Summary

Fixes the Dart LSP failing on Windows with "Command not found: dart" error by adding shell: true to the spawn options when running on Windows.

Problem

On Windows, the Dart LSP server fails to start even when dart is correctly installed and in PATH. The error occurs because:

  1. Bun.which("dart") finds a valid path (e.g., C:\Users\...\bin\dart.exe)
  2. However, spawn() without shell: true can fail on Windows for certain executable configurations

Solution

Add shell: process.platform === "win32" to the spawn options, following the same pattern used elsewhere in the codebase (e.g., npm.cmd handling in ESLint LSP).

Testing

  • Verified on Windows 10/11 with Dart SDK 3.5.4
  • Confirmed dart language-server --lsp works via shell
  • Minimal change, no impact on non-Windows platforms

Fixes #6861

cc @thdxr @adamdotdevin

On Windows, Bun.which('dart') may resolve to a .cmd shim or
the spawn call may fail without shell: true. This adds the
shell option specifically for Windows to fix the 'Command not
found: dart' error.

Fixes anomalyco#6861
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dart LSP fails on Windows: 'Command not found' despite dart being in PATH

2 participants