sublimelsp / LSP-svelte

Convenience plugin for Svelte Language Tools
MIT License
16 stars 0 forks source link

LSP crashes on WSL system #144

Open rhyses-pieces opened 2 days ago

rhyses-pieces commented 2 days ago

Operating System: Windows 11 Home Version 23H2 (build 22631.4460) Sublime Text Version: 4180

I'm using WSL2 to work on a Svelte project, but I noticed that the LSP crashes when opening a .svelte file. I've tried searching for issues narrowing down on WSL2 paths and the like but I wasn't able to find anything substantial.

Steps to get this error:

  1. Install LSP-svelte plugin from Package Control
  2. Create a new SvelteKit project using npx sv create svelte-5-test in WSL2 system
  3. Open .svelte file in the new SvelteKit project
LSP-svelte: Initialize new ts service at  //wsl.localhost/Ubuntu/{wsl_username}/svelte-5-test/tsconfig.json
LSP-svelte: Trying to load configs for //wsl.localhost/Ubuntu/{wsl_username}/svelte-5-test
LSP-svelte: node:internal/fs/watchers:247
LSP-svelte:     const error = new UVException({
LSP-svelte:                   ^
LSP-svelte: 
LSP-svelte: Error: EISDIR: illegal operation on a directory, watch '//wsl.localhost/Ubuntu/{wsl_username}/svelte-5-test'
LSP-svelte:     at FSWatcher.<computed> (node:internal/fs/watchers:247:19)
LSP-svelte:     at watch (node:fs:2490:36)
LSP-svelte:     at createFsWatchInstance (C:\Users\{username}\AppData\Local\Sublime Text\Package Storage\LSP-svelte\20.18.0\server\node_modules\chokidar\handler.js:130:31)
LSP-svelte:     at setFsWatchListener (C:\Users\{username}\AppData\Local\Sublime Text\Package Storage\LSP-svelte\20.18.0\server\node_modules\chokidar\handler.js:175:19)
LSP-svelte:     at NodeFsHandler._watchWithNodeFs (C:\Users\{username}\AppData\Local\Sublime Text\Package Storage\LSP-svelte\20.18.0\server\node_modules\chokidar\handler.js:329:22)
LSP-svelte:     at NodeFsHandler._handleDir (C:\Users\{username}\AppData\Local\Sublime Text\Package Storage\LSP-svelte\20.18.0\server\node_modules\chokidar\handler.js:550:27)
LSP-svelte:     at NodeFsHandler._addToNodeFs (C:\Users\{username}\AppData\Local\Sublime Text\Package Storage\LSP-svelte\20.18.0\server\node_modules\chokidar\handler.js:595:37)
LSP-svelte:     at async C:\Users\{username}\AppData\Local\Sublime Text\Package Storage\LSP-svelte\20.18.0\server\node_modules\chokidar\index.js:347:25
LSP-svelte:     at async Promise.all (index 0)
LSP-svelte: Emitted 'error' event on FSWatcher instance at:
LSP-svelte:     at FSWatcher._handleError (C:\Users\{username}\AppData\Local\Sublime Text\Package Storage\LSP-svelte\20.18.0\server\node_modules\chokidar\index.js:538:18)
LSP-svelte:     at NodeFsHandler._addToNodeFs (C:\Users\{username}\AppData\Local\Sublime Text\Package Storage\LSP-svelte\20.18.0\server\node_modules\chokidar\handler.js:627:26)
LSP-svelte:     at async C:\Users\{username}\AppData\Local\Sublime Text\Package Storage\LSP-svelte\20.18.0\server\node_modules\chokidar\index.js:347:25
LSP-svelte:     at async Promise.all (index 0) {
LSP-svelte:   errno: -4068,
LSP-svelte:   syscall: 'watch',
LSP-svelte:   code: 'EISDIR',
LSP-svelte:   path: '//wsl.localhost/Ubuntu/{wsl_username}/svelte-5-test',
LSP-svelte:   filename: '//wsl.localhost/Ubuntu/{wsl_username}/svelte-5-test'
LSP-svelte: }
LSP-svelte: 
LSP-svelte: Node.js v20.18.0
rhyses-pieces commented 18 hours ago

Update:

I added the CHOKIDAR_USEPOLLING: 1 environment variable for the LSP settings, which seems to work, but I'm now running into the issue where the installed Node executable bundled with Sublime Text throws an error since the npm dependencies on WSL aren't compatible. Rollup, in particular, seems to be the culprit since I run into this particular error:

LSP-svelte: Error: Cannot find module @rollup/rollup-win32-x64-msvc. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.

I tried installing the dependencies with npm, pnpm, and bun with similar results, wherein all the package managers installed in WSL only install Linux-dependent dependencies.

Is there any way to just use Node installed in WSL to make this work?