Skip to content

Commit d1acad0

Browse files
committed
Add extra suggestions when Hex can't be installed, closes #10039
1 parent 4a69a00 commit d1acad0

File tree

2 files changed

+24
-4
lines changed

2 files changed

+24
-4
lines changed

lib/mix/lib/mix/local.ex

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,29 @@ defmodule Mix.Local do
161161
contents
162162

163163
{:remote, message} ->
164-
Mix.raise("""
165-
#{message}
164+
Mix.raise(
165+
"""
166+
#{message}
166167
167-
Could not install #{name} because Mix could not download metadata at #{path}.
168-
""")
168+
Could not install #{name} because Mix could not download metadata at #{path}.
169+
""" <> suggestions(name)
170+
)
169171
end
170172
end
171173

174+
defp suggestions("Hex") do
175+
"""
176+
177+
Alternatively, you can compile and install Hex directly with this command:
178+
179+
mix archive.install github hexpm/hex branch latest
180+
"""
181+
end
182+
183+
defp suggestions(_) do
184+
""
185+
end
186+
172187
defp parse_csv(body) do
173188
body
174189
|> :binary.split("\n", [:global, :trim])

lib/mix/lib/mix/tasks/local.hex.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ defmodule Mix.Tasks.Local.Hex do
1111
1212
mix local.hex
1313
14+
If installing a precompiled Hex does not work, you can compile and install
15+
Hex directly with this command:
16+
17+
mix archive.install github hexpm/hex branch latest
18+
1419
## Command line options
1520
1621
* `--force` - forces installation without a shell prompt; primarily

0 commit comments

Comments
 (0)