scalameta / metals

Scala language server with rich IDE features 🚀
https://scalameta.org/metals/
Apache License 2.0
2.04k stars 319 forks source link

Metals won't start server #6166

Open Polymeth opened 4 months ago

Polymeth commented 4 months ago

Describe the bug

When I launch Metals on VSCode for any Scala project (projects working before!), It says 'Metals client: couldn't create connection to server.' When I clicked see outputs, here is what I have :

Java home: /usr/bin/java
Metals version: 1.2.2
Using coursier located at /usr/local/bin/coursier
[Error - 11:02:32] Metals client: couldn't create connection to server.
Error: spawn ENOTDIR
    at ChildProcess.spawn (node:internal/child_process:413:11)
    at Object.spawn (node:child_process:806:9)
    at /Users/polymeth/.vscode/extensions/scalameta.metals-1.29.0/node_modules/vscode-languageclient/lib/node/main.js:426:46
    at async LanguageClient.createConnection (/Users/polymeth/.vscode/extensions/scalameta.metals-1.29.0/node_modules/vscode-languageclient/lib/common/client.js:1094:28)
    at async LanguageClient.start (/Users/polymeth/.vscode/extensions/scalameta.metals-1.29.0/node_modules/vscode-languageclient/lib/common/client.js:634:32)
Could not launch Metals Language Server:
spawn ENOTDIR
Release notes was not shown: not showing release notes since they've already been seen for your current version

I obviously reinstalled Metals, Coursier, VSCode and even NodeJS. My only way to fix this problem was reinstalling everything AND switching to the pre-release version.

Expected behavior

Metals working as before I guess.

Operating system

macOS Ventura

Editor/Extension

VS Code

Version of Metals

v1.29.0

Extra context or search terms

No response

tgodzik commented 4 months ago

Thanks for reporting! Is /usr/local/bin/coursier available? Would be great to see what was the problematic executable.

Otherwise, we just updated a lot of the logic that deals with starting VS Code, so this could be a bit streamlined

kasiaMarek commented 4 months ago

It looks like your JAVA_HOME is a path to a java executable not a Java home directory as we expect.

kasiaMarek commented 1 week ago

Does this issue persist?