sublimelsp / LSP-typescript

TypeScript, JavaScript support for Sublime LSP plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot start language server

jacksonzamorano opened this issue · comments

I started Sublime Text today and found out that for some reason the server cannot start.

LSP-typescript: /Users/jacksonzamorano/Library/Caches/Sublime Text/Package Storage/LSP-typescript/12.13.0/typescript-language-server/node_modules/typescript-language-server/lib/cli.js:8
LSP-typescript: import { readFileSync } from 'node:fs';
LSP-typescript: ^^^^^^
LSP-typescript: 
LSP-typescript: SyntaxError: Cannot use import statement outside a module
LSP-typescript:     at Module._compile (internal/modules/cjs/loader.js:892:18)
LSP-typescript:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
LSP-typescript:     at Module.load (internal/modules/cjs/loader.js:812:32)
LSP-typescript:     at Function.Module._load (internal/modules/cjs/loader.js:724:14)
LSP-typescript:     at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
LSP-typescript:     at internal/main/run_main_module.js:17:11

It appears that the issue lies in the cli.js file provided by typescript-language-server is not truly a js file; it is still a TypeScript file. This happens with typescript-language-server versions 1.1.1 and 1.1.2.

We can see from the path that it's 12.13.0.

Added a minimum Node version constraint in 75bca93 to give a proper error message in this case.

@rchl @predragnikolic Thanks for your help! Apparently my system node version was overriding my NVM version in Sublime only. The latest update offered to download Node for me, and that fixed it.

I really appreciate your help!