Skip to content

TypeScript language server fails to start: "Could not find a valid TypeScript installation" with TypeScript 6.x and Bun #647

@been-there-done-that

Description

@been-there-done-that

Description

When opening a TypeScript/SvelteKit project that uses TypeScript 6.x managed by Bun, the language server fails to initialize with the following error:

LSP error: Object {"code": Number(-32603), "message": String("Request initialize failed with message: Could not find a valid TypeScript installation. Please ensure the "typescript" dependency is installed in the workspace or that a valid tsserver.path is specified. Exiting.")}

TypeScript is installed in the workspace — the issue appears to be a compatibility mismatch between the system-installed typescript-language-server (4.3.3) and TypeScript 6.x.

Steps to Reproduce

  1. Create or open a SvelteKit project with "typescript": "^6.0.x" as a devDependency
  2. Install dependencies with Bun (bun install)
  3. Open any .ts or .svelte.ts file in Athas
  4. Observe the "Failed to start language server" toast and the LSP error above

Environment

OS macOS 15 (Darwin 25.4.0)
Package manager Bun v1.3.9
Project TypeScript version 6.0.3 (devDependency in package.json)
System TypeScript (tsc --version) 5.7.2 (Homebrew)
typescript-language-server version 4.3.3 (Homebrew, /opt/homebrew/bin/typescript-language-server)
tsserver in project Present at node_modules/.bin/tsserver and node_modules/typescript/bin/tsserver

Analysis

  • typescript is present in node_modules/typescript with lib/tsserver.js and bin/tsserver intact
  • The error originates from typescript-language-server, which validates the TypeScript installation at startup
  • typescript-language-server 4.3.3 may not recognise TypeScript 6.x as a valid installation (its peer dependency range likely caps at 5.x)
  • Bun's node_modules linking could also affect path resolution when the LSP server traverses upward to find TypeScript

Workaround

Pinning TypeScript to 5.7.x in package.json and re-running bun install resolves the error. TypeScript 6.x projects remain broken.

Suggested Fix

  • Ship a bundled/pinned version of typescript-language-server that supports TypeScript 6.x, or
  • Expose a tsserver.path / typescript.tsdk setting in Athas so users can point to the local node_modules/typescript explicitly, or
  • Detect TypeScript 6.x as a valid installation and surface a clearer error (e.g. "typescript-language-server 4.x does not support TypeScript 6.x — update Athas or pin typescript@5")

Happy to investigate further and open a PR if the team can point me to where the LSP language server configuration lives.

Metadata

Metadata

Labels

LSPLanguage server and diagnostics

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions