karang

karang

ElixirLS cannot connect to server in VScode

I am not sure what has changed but now ElixirLS does not work for me anymore. I am using the latest vscode (1.77.3) and the latest elixir ls extension (0.14.3). I have elixir 14.2 and OTP 25 installed through asdf. I get the following messages when starting with the command code . :

ElixirLS - asc_enfusion client: couldn't create connection to server.
The ElixirLS - asc_enfusion server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.

Here is the output:

Starting ElixirLS release v0.14.3
Running in /home/me/my_project
** (Mix.Error) Command "git --git-dir=.git fetch --force --quiet --progress --tags" failed
    (mix 1.14.2) lib/mix.ex:513: Mix.raise/2
    (mix 1.14.2) lib/mix/scm/git.ex:132: Mix.SCM.Git.checkout/2
    (elixir 1.14.2) lib/file.ex:1607: File.cd!/2
    (mix 1.14.2) lib/mix/dep/fetcher.ex:61: Mix.Dep.Fetcher.do_fetch/3
    (mix 1.14.2) lib/mix/dep/converger.ex:213: Mix.Dep.Converger.all/9
    (mix 1.14.2) lib/mix/dep/converger.ex:146: Mix.Dep.Converger.all/7
    (mix 1.14.2) lib/mix/dep/converger.ex:95: Mix.Dep.Converger.all/4
    (mix 1.14.2) lib/mix/dep/converger.ex:74: Mix.Dep.Converger.converge/4

I do have some settings in my .gitconfig as well. Any clues on what is going on? Thanks

Most Liked

neiby

neiby

I was able to solve this accidentally with the help of others while working on a different problem. I’m running on a Mac, which uses LibreSSL 3.3.6 instead of the regular openssl. This was causing the crypto module to be ignored when I installed erlang via asdf. The solution was to use Homebrew to install openssl, then tell KERL (which asdf uses) to use this version of openssl:

export KERL_CONFIGURE_OPTIONS="--without-javac --with-ssl=$(brew --prefix openssl@3"

Then I reinstalled erlang via asdf and all is well now. The crypto module is no longer ignored during erlang installation and I can use the latest version of ElixirLS with no problem.

kushalj

kushalj

I just fixed this on my Windows WSL Ubuntu setup.

TL;DR
What I did:
sudo apt remove elixir
sudo apt-get install libssl-dev
asdf plugin-add erlang
asdf plugin-add elixir
asdf install erlang 26.1.1
asdf install elixir 1.15.6-otp-26
asdf global erlang 26.1.1
asdf global elixir 1.15.6-otp-26


Basically, the sudo apt approach is broken. The way to test it is to git clone the ElixirLS repo and try to compile it.

mix deps.get and then mix compile

If this works, there’s good bet that VSCode doing the same thing (compiling ElixirLS) will work and connect.

I removed the elixir install and reinstalled using the embedded elixir approach. - however there is a dependency (documented here: [WSL - mix deps.get] The application "crypto" could not be found - #9 by thelucassampaio) - which is that you need to install libssl first and then use asdf to install-compile erlang and then elixir.

If this worked then the ElixirLS you cloned into a folder should compile. If not, see what error you are getting and go search - this is how I worked my way through this.

Only took 4 hours :man_facepalming:

It may not be the “correct” approach but at least it’s working for me now.

Where Next?

Popular in Questions Top

_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: <h1>Create Post</h1> <%= ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New

Other popular topics Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Nvim
Anybody knows a comprehensive comparison of Django and Phoenix, thanks for the help. Where are they similar? Where do they differ the m...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
saif
Hello everyone, Long time lurker first time poster here. I’ve recently begun working on Elixir full-time again! :raised_hands: It’s been...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New

We're in Beta

About us Mission Statement