nathankg

nathankg

ElixirLS Extension Not Working, Support Needed using ASDF & Brew & Elixir

Good day, folks!

This is my first day using Elixir (1.14.4 (compiled with Erlang/OTP 25)) & the ElixirLS: Elixir support and debugger VS Code extension (v0.15.3).

When I try running the extension on VS Code (for my code “checkmate_api”), I receive an error about
the module ElixirLS.Shell.Quiet.

Running /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/launch.sh
Looking for ASDF install in /usr/local/opt/asdf/libexec/asdf.sh
ASDF found, relaunching in bash shell
Looking for ASDF install in /usr/local/opt/asdf/libexec/asdf.sh
Sourcing ASDF
** (ArgumentError) could not call Module.put_attribute/3 because the module ElixirLS.Shell.Quiet is already compiled
    (elixir 1.14.4) lib/module.ex:2504: Module.assert_not_readonly!/2
    (elixir 1.14.4) lib/module.ex:2201: Module.__put_attribute__/5
    /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/installer.exs:60: (module)
    /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/installer.exs:59: (file)
[Error - 12:42:28 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 12:42:28 PM] Connection to server got closed. Server will restart.
true
[Error - 12:42:28 PM] ElixirLS - checkmate_api client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Running /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/launch.sh
Looking for ASDF install in /usr/local/opt/asdf/libexec/asdf.sh
ASDF found, relaunching in bash shell
Looking for ASDF install in /usr/local/opt/asdf/libexec/asdf.sh
Sourcing ASDF
** (ArgumentError) could not call Module.put_attribute/3 because the module ElixirLS.Shell.Quiet is already compiled
    (elixir 1.14.4) lib/module.ex:2504: Module.assert_not_readonly!/2
    (elixir 1.14.4) lib/module.ex:2201: Module.__put_attribute__/5
    /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/installer.exs:60: (module)
    /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/installer.exs:59: (file)
[Error - 12:42:30 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 12:42:30 PM] Connection to server got closed. Server will restart.
true
[Error - 12:42:30 PM] ElixirLS - checkmate_api client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Running /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/launch.sh
Looking for ASDF install in /usr/local/opt/asdf/libexec/asdf.sh
ASDF found, relaunching in bash shell
Looking for ASDF install in /usr/local/opt/asdf/libexec/asdf.sh
Sourcing ASDF
** (ArgumentError) could not call Module.put_attribute/3 because the module ElixirLS.Shell.Quiet is already compiled
    (elixir 1.14.4) lib/module.ex:2504: Module.assert_not_readonly!/2
    (elixir 1.14.4) lib/module.ex:2201: Module.__put_attribute__/5
    /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/installer.exs:60: (module)
    /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/installer.exs:59: (file)
[Error - 12:42:32 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 12:42:32 PM] Connection to server got closed. Server will restart.
true
[Error - 12:42:32 PM] ElixirLS - checkmate_api client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:42:32 PM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Running /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/launch.sh
Looking for ASDF install in /usr/local/opt/asdf/libexec/asdf.sh
ASDF found, relaunching in bash shell
Looking for ASDF install in /usr/local/opt/asdf/libexec/asdf.sh
Sourcing ASDF
** (ArgumentError) could not call Module.put_attribute/3 because the module ElixirLS.Shell.Quiet is already compiled
    (elixir 1.14.4) lib/module.ex:2504: Module.assert_not_readonly!/2
    (elixir 1.14.4) lib/module.ex:2201: Module.__put_attribute__/5
    /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/installer.exs:60: (module)
    /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/installer.exs:59: (file)
[Error - 12:42:33 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Info  - 12:42:33 PM] Connection to server got closed. Server will restart.
true
[Error - 12:42:33 PM] ElixirLS - checkmate_api client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:42:33 PM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097 
Running /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/launch.sh
Looking for ASDF install in /usr/local/opt/asdf/libexec/asdf.sh
ASDF found, relaunching in bash shell
Looking for ASDF install in /usr/local/opt/asdf/libexec/asdf.sh
Sourcing ASDF
** (ArgumentError) could not call Module.put_attribute/3 because the module ElixirLS.Shell.Quiet is already compiled
    (elixir 1.14.4) lib/module.ex:2504: Module.assert_not_readonly!/2
    (elixir 1.14.4) lib/module.ex:2201: Module.__put_attribute__/5
    /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/installer.exs:60: (module)
    /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/installer.exs:59: (file)
[Error - 12:42:36 PM] Server initialization failed.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:42:36 PM] The ElixirLS - checkmate_api server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
[Error - 12:42:36 PM] ElixirLS - checkmate_api client: couldn't create connection to server.
  Message: Pending response rejected since connection got disposed
  Code: -32097 
[Error - 12:42:36 PM] Restarting server failed
  Message: Pending response rejected since connection got disposed
  Code: -32097

I’ve been racking my brain trying to understand what’s happening here and this has led to many installs, uninstalls, and reinstalls using homebrew & asdf. When installing elixir via asdf, I’ve noticed that in my root directory of my “users/nathangupta”, we create a hidden directory with an elixir executable:

/Users/nathangupta/.asdf/shims/elixir

and then the versions are added in the “installs” directory.

I’ve also noticed that I have elixir in this directory /usr/local/Cellar/elixir/1.15.2 likely because I did brew install elixir.

What I don’t understand is why we look for ASDF twice if it’s found the first time, and I’m not sure what’s happening the second time around.

For additional context, this is my ./zshrc file.

if command -v pyenv 1>/dev/null 2>&1; then eval "$(pyenv init -)"; fi

export PATH="/Library/PostgreSQL/14/bin:$PATH"
export PATH="/usr/local/opt/docker/bin:$PATH"
export PATH="/usr/local/etc/bash_completion.d/docker:$PATH"
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/opt/erlang/bin:$PATH"
export PATH="/usr/local/Cellar/:$PATH"

export LDFLAGS="-L$(brew --prefix openssl)/lib"
export CPPFLAGS="-I$(brew --prefix openssl)/include"

export PATH="/usr/local/opt/erlang@25/bin:$PATH"


export PATH="$PATH:/Users/nathangupta/.local/bin"

. /usr/local/opt/asdf/libexec/asdf.sh

Most Liked

hubertlepicki

hubertlepicki

I don’t use VSCode, but other editor that integrates with Elixir LS and I think I saw an issue where it didn’t work if I started my editor from a different path than my project path.

So what I do is that I open a terminal, then navigate to the project directory. This picks up the .tool-version file and sets all the paths and env variables up and from within that directory I launch my code editor.

Did you try doing exactly that?

baltazaro

baltazaro

I also use asdf and I had a similar problem. I solved it by adding erlang to my ~/.tool-versions

elixir 1.15.7
erlang 26.0
lukaszsamson

lukaszsamson

ElixirLS Core Team

Strange issue, I opened Launch script can fail · Issue #944 · elixir-lsp/elixir-ls · GitHub
It looks like ElixirLS.Shell.Quiet is already compiled in your shell. Have you installed elixir-ls from brew?
You should be able to execute /Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/language_server.sh from your project directory. You can also try directly running the launch script

export ELS_MODE=language_server
export MIX_ENV=prod
elixir --erl "-kernel standard_io_encoding latin1" "/Users/nathangupta/.vscode/extensions/jakebecker.elixir-ls-0.15.3/elixir-ls-release/launch.exs"

maybe it will help to spot what’s wrong

What I don’t understand is why we look for ASDF twice

The launch script starts as a POSIX shell script and then it reloads itself as bash or zsh script. ASDF does not support POSIX shell

nathankg

nathankg

Really appreciate the suggestion. I gave this a shot & still no luck. I’m seeing the same error.

Thank you for this suggestion too! And I appreciate you opening the issue in the extension repo. So I didn’t install elixir-ls directly; instead I installed elixir using homebrew & the elixir-ls extension on VS Code. However, I’ve since tried installing elixir-ls via brew, and I’m seeing the same issue.

What I’m trying to figure out is where I might have an extra path or an extra install that’s leading to an already compiled ElixirLS.Shell.Quiet

lukaszsamson

lukaszsamson

ElixirLS Core Team

Unfortunately I’m not able to reproduce your issue. Please uninstall brew installed elixir-ls as it’s some unofficial package. Clean up your extension directory as well. Also in my experience ASDF, elixir and erlang installed via brew equals problems

Where Next?

Popular in Questions Top

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
mathew4509
I have a list say x = ["23gh", "56kh", "97mh"] I would like to pass each element to Val in each iteration. Say, in iteration 1 -------...
New
gonzofish
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
chrisalley
ExUnit now has describe blocks which is a welcome addition coming from RSpec. In the docs, it states that nested hierarchies of describe ...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New

Other popular topics Top

sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
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
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
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
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
273 38985 115
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

We're in Beta

About us Mission Statement