travisf

travisf

Elixir-ls fails to start due to hex issues

I used to manage all of my Elixir stuff with ASDF but I’ve been consulting on a Ruby project and mise seemed to work better there so I made the switch. However, this seems to have broken my Elixir LSPs. I don’t know too much about what’s going on under the hood with Hex so forgive my ignorance here.

If I run mix hex.info I get this:

Hex:    2.4.1
Elixir: 1.19.5
OTP:    28.3

Built with: Elixir 1.19.5 and OTP 28.4.1

However, if I then run elixir-ls I get this:

Running /Users/travis/.local/share/mise/installs/elixir-ls/0.30.0/launch.sh
Preferred shell is zsh, relaunching
Looking for asdf install
Legacy asdf not found at /Users/travis/.asdf/asdf.sh
unknown command: elixir. Perhaps you have to reshim?
Running setup script /Users/travis/.config/elixir_ls/setup.sh
Installing ElixirLS release v0.30.0
Running in /Users/travis/Documents/my_project
* Updating elixir_ls (https://github.com/elixir-lsp/elixir-ls.git - v0.30.0)
==> language_server
Could not find Hex, which is needed to build dependency :stream_data
Shall I install Hex? (if running non-interactively, use "mix local.hex --force")
* creating /Users/travis/.local/share/mise/installs/elixir/1.19.5-otp-28/.mix/archives/hex-2.4.1
Could not start Hex. Try fetching a new version with "mix local.hex" or uninstalling it with "mix archive.uninstall hex.ez"
Mix.install failed with ** (UndefinedFunctionError) function Hex.start/0 is undefined (module Hex is not available)
    Hex.start()
    (mix 1.13.4) lib/mix/hex.ex:59: Mix.Hex.start/0
    (mix 1.13.4) lib/mix/dep/loader.ex:203: Mix.Dep.Loader.with_scm_and_app/4
    (mix 1.13.4) lib/mix/dep/loader.ex:156: Mix.Dep.Loader.to_dep/3
    (elixir 1.13.4) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
    (elixir 1.13.4) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
    (mix 1.13.4) lib/mix/dep/loader.ex:373: Mix.Dep.Loader.mix_children/2
    (mix 1.13.4) lib/mix/dep/loader.ex:331: anonymous fn/4 in Mix.Dep.Loader.mix_dep/2

Retrying Mix.install with force: true

I’ve run mix archive uninstall hex.ez and reinstalled hex (this was before getting the above yet again).

Something that may or may not be related is simply running mix hex I get this warning:

07:00:27.523 [error] beam/beam_load.c(219): Error loading module 'Elixir.Hex':
  This BEAM file was compiled for an old version of the runtime system.
  To fix this, please re-compile this module with Erlang/OTP 25 or later.



Mix requires the Hex package manager to fetch dependencies
Shall I install Hex? (if running non-interactively, use "mix local.hex --force") [Yn]

There have been a few, project specific, occasions where something like elixir-ls would start working in my terminal, however it would crash in in Zed or Sublime right around the Could not start Hex. Try fetching a new version....

Most Liked

dimitarvp

dimitarvp

I am a bit perplexed on why would you need elixir-ls managed by asdf or mise at all? Why not let your code editor manage it?

Last Post!

travisf

travisf

Generally I do, I was just playing around with it locally in my terminal to see if it would run. If I mise unuse elixir-ls and let Zed handle it the error message is the same from the Zed lsp logs. The logging from Sublime isn’t quite as detailed but I suspect the same error is at the heart of those issues as well.

Where Next?

Popular in Questions Top

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
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New

Other popular topics Top

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
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
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
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
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement