TypeError: server.watchFiles is not a function

/Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26/node_modules/@vue/language-server/lib/initialize.js:56
            fileWatcher = server.watchFiles(['**/*.{' + [...watchingExtensions].join(',') + '}']);
                                 ^

TypeError: server.watchFiles is not a function
    at updateFileWatcher (/Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26/node_modules/
@vue
/language-server/lib/initialize.js:56:34)
    at /Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26/node_modules/
@vue
/language-server/lib/initialize.js:29:9
    at async createTypeScriptLS (/Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26/node_modules/
@volar
/language-server/lib/project/typescriptProjectLs.js:32:40)
    at async getCommandLine (/Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26/node_modules/
@volar
/language-server/lib/project/typescriptProject.js:184:29)
    at async prepareClosestootCommandLine (/Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26/node_modules/
@volar
/language-server/lib/project/typescriptProject.js:102:17)
    at async findMatchTSConfig (/Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26/node_modules/
@volar
/language-server/lib/project/typescriptProject.js:91:9)
    at async Object.getLanguageService (/Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26/node_modules/
@volar
/language-server/lib/project/typescriptProject.js:48:30)
    at async updateDiagnostics (/Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26/node_modules/
@volar
/language-server/lib/features/languageFeatures.js:703:33)
    at async updateDiagnosticsBatch (/Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26/node_modules/
@volar
/language-server/lib/features/languageFeatures.js:699:13)

Node.js v20.17.0
Exit code: 1
Command line: /usr/local/bin/node /Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26/node_modules/@vue/language-server/bin/vue-language-server.js --stdio
StdIO connection closed

0
18 comments

The long-term solution (bundling the package) is planned for 2024.3.

Please note that Vue Language Server 2.1.2 was just released. We'll update the default version in future WebStorm build & and for the meantime, you can follow similar steps as described above, the fastest way would be:

Go to the registry (shift-shift/search everywhere) and type in 'registry' → in the window that opens type vue.language.server.default.version and change the value to 2.1.2. For this to properly work though, make sure that in the Vue Language Server Dropdown ( Settings → Languages & Frameworks → TypeScript → Vue) the Default is selected, it should also list the version 2.1.2 there. A LS restart may also be required.

9

The problem is caused by the regression within Volar which is a transitive dependency of the Vue language server. Depending on when the version of the Vue language server was installed it might have installed a buggy version of Volar.
We are in contact with the Volar team and a fix is being worked on. Nevertheless, there are 2 reasonable short-term workarounds you can apply:

  1. inside your project folder execute the following command:

npm i -S --save-exact @vue/language-server@2.0.28 @volar/language-server@2.4.0-alpha.18
Afterward, go to Preferences → Languages & Frameworks → TypeScript → Vue and click on the 3-dot menu next to the dropdown for Vue Language Server. This will allow you to specify a custom LS. In the window that opens, you select your project folder → node_modules@vuelanguage-server (select the 'root' folder of the language server node module). After that for good measures restart the Vue Language Server in the LSP widget in the lower right corner (there it should also list version 2.0.28)

2. Alternatively, you can run the npm install @volar/language-core@2.4.0 @volar/language-server@2.4.0 command in the /usr/local/bin/node /Users/zzg/Library/Caches/JetBrains/WebStorm2024.2/javascript/typings/@vue/language-server/2.0.26 folder.
 
2. Or, you could revert to version 1 of the Vue LSP for the time being. For this go to the registry (shift-shift/search everywhere) and type in `registry` → in the window that opens type vue.language.server.default.version and change the value to 1.8.27. For this to properly work though, make sure that in the Vue Language Server Dropdown ( Preferences → Languages & Frameworks → TypeScript → Vue) the Default is selected, it should also list the version 1.8.27 there.
 
The long-term solution
To prevent issues like this from happening again, we have decided to bundle a stable version of the language servers with the IDE. This way we can ensure a stable product with a fixed, verified dependencies. There are some implications around artifact size and similar constraints, but this is currently our best solution. Anyway, we hope to ship a long-term fix in the next major release, but we will keep you updated through the regular channels.

5

Issue still exists in 2024.2.3

3

Can confirm issue happens after updating to Webstorm 2024.2.3

2

I have the same issue in  IntelliJ IDEA 2024.2.1 (Ultimate Edition) Build #IU-242.21829.142, built on August 28, 2024.

Thank you for the workaround, it works, waiting for news for a long-term solution.

 

 


 

1

Elena Pogorelova, I'm sorry, but I'm asking when, as in what date can we expect this?  IMO, this should be a hotfix because it affects every Vue + TS dev, and having each of them install another module to fix the issue is a little silly.  The other thing is, if we go weeks or months between the next version, I'm going to forget that I've applied this patch, and that I've applied it in multiple projects… so I won't remember to undo this patch and could eventually get unexpected TS errors, which could cause possible support issues for you down the road!

joaopedrocordeiroserra, you should be able to install the module globally and point your projects to that instead… that wouldn't affect your project's package.json.

1

I don't have the option to select any version other than 2.0.26 as of Build #WS-242.21829.149, built on August 29, 2024

0

Did you try the instructions above (installing the server in a project folder or changing the registry key)?

0

Elena Pogorelova any update on when we can see this patched?  I'm using Rider, and ever since I updated to the latest release and used your workaround above, I've been having so many perf issues… intellisense is incredibly slow, the IDE is slow to reflect any errors, etc.

0

The problem you’ve described seems out of the scope of this issue. Please try taking CPU snapshots (https://intellij-support.jetbrains.com/hc/en-us/articles/207241235-Reporting-performance-problems) when it runs slow and submit them along with the logs (Help | Collect Logs and Diagnostic Data) within a support ticket

0

Elena Pogorelova Okay, thanks, but also the question still stands about when the thread's issue might be patched?

0
You can fix the issue by installing the proper Volar version.
In the future versions we plan to bundle the whole package, please see above.
0

Elena Pogorelova yes, installing the Volar versions in my project works, but i can't commit that change to my organization's repo so it's still very annoying, hopefully it'll be fixed soon in Webstorm itself

0

Thank you very much, Elena Pogorelova.  I appreciate everything you do on these forums!

0

I confirm the registry fix did the thing for me!

0

workaround works great thank you!

0

Please sign in to leave a comment.