-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v0.21.1 can not find hex under debian12.5 #1092
Comments
i checked the code of elixir-ls Mix.Hex.ensure_installed?(true) but i don't know where is the definition, how it works, i need to know it to check my configuration. |
This code calls a function in elixir standard lib |
Mix.Hex.ensure_installed? seems to be like this @spec ensure_installed?(boolean) :: boolean
def ensure_installed?(force?) do
cond do
Code.ensure_loaded?(Hex) -> true
force? or install_hex?() -> Mix.Tasks.Local.Hex.run(["--force"])
true -> false
end
end and the install.exs from vscode plugin look like this so confused, elixir environment is just quite simple apt install elixir
mix local.hex I'm not sure it is caused by my configurtion, i reinstall debian, only install these vscode
apt install elixir -y
proxychains
proxychains mix local.hex create demo project mix new demo i have no idea about it. |
it seems to be working, need a bit change of code scripts/installer.exs defp load_hex do
if !Code.ensure_loaded?(Hex) do
base_dir = System.user_home |> Path.join(".mix/archives")
if base_dir |> File.exists? do
sub_dirs = File.ls!(base_dir)
if sub_dirs |> Enum.count() > 0 do
hex_dirs = Enum.filter(sub_dirs, fn dir -> dir |> String.starts_with?("hex-") end)
hex_dir = Enum.reduce(hex_dirs, fn dir, saved_dir ->
start_pos = String.length("hex-")
ver1 = dir |> String.slice(start_pos..-1) |> Version.parse!()
ver2 = saved_dir |> String.slice(start_pos..-1) |> Version.parse!()
case Version.compare(ver1, ver2) do
:gt ->
dir
:lt ->
saved_dir
:eq ->
[dir, saved_dir] |> Enum.random()
end
end)
hex_beam_path = base_dir |> Path.join(hex_dir) |> Path.join(hex_dir) |> Path.join("ebin")
Code.append_path(hex_beam_path)
end
end
end
end line 342 load_hex()
cond do xxx
|
making symbolic connection to system lib seems to be the easiest way, no need to change anything sudo ln -s ~/.mix/archives/hex-2.0.6/hex-2.0.6 /usr/lib/elixir/lib/hex |
I have debian and manjaro linux for daily use, Hex can not be found only appeared under debian, it can be found under manjaro. They have the same networking configuation, i use git proxy and hex.pm mirror for both.
Precheck
Do a quick search and make sure the issue has not yet been reported
yes, i searched, but not working.
Do not use the issues tracker for guidance, questions or support (try Elixir Forum, Stack Overflow, Slack, etc. instead)
yes, not working.
If using a client other than VS Code, please try VSCode's "ElixirLS: Elixir support and debugger" extension. Does it reproduce your failure?
yes.
Environment
elixir was installed by apt, not asdf
i am not sure, accoring the logs, i think maybe is v0.21.1
vscode
Current behavior
can not find hex under debian12.5
due to gfw, i need to use mirror to access repo.hex.pm, and also i need to use proxy for git.
my hexpm mirror, according https://hex.pm/docs/mirrors
my git mirror
i download hex manually
then
when i create demo project
open with vscode, then check the elixirls output
i had installed hex, but plugin can not find it.
Expected behavior
hex can be found by elixir-ls
same behavior for astronvim
The text was updated successfully, but these errors were encountered: