I am trying to install hex by mix command. but it fails everytime
elixir --version
Erlang/OTP 20 [erts-9.2] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10]
Elixir 1.6.1 (compiled with OTP 19)
Windows 10
mix local.hex
20:17:01.320 [error] Process #PID<0.112.0> raised an exception
** (ErlangError) Erlang error: :enoent
erlang.erl:2118: :erlang.open_port({:spawn, 'inet_gethost 4 '}, [{:packet, 4}, :eof, :binary])
(kernel) inet_gethost_native.erl:184: :inet_gethost_native.server_init/2
** (Mix) httpc request failed with: {:failed_connect, [{:to_address, {'repo.hex.pm', 443}}, {:inet, [:inet], {:eoptions, {:could_not_start_server, :inet_gethost_native}}}]}
Could not install Hex because Mix could not download metadata at https://repo.hex.pm/installs/hex-1.x.csv.
20:17:01.500 [error] GenServer :inet_gethost_native_sup terminating
** (stop) :enoent
erlang.erl:2118: :erlang.open_port({:spawn, 'inet_gethost 4 '}, [{:packet, 4}, :eof, :binary])
(kernel) inet_gethost_native.erl:184: :inet_gethost_native.server_init/2
Last message: {:EXIT, #PID<0.112.0>, {:enoent, [{:erlang, :open_port, [{:spawn, 'inet_gethost 4 '}, [{:packet, 4}, :eof, :binary]], [file: 'erlang.erl', line: 2118]}, {:inet_gethost_native, :server_init, 2, [file: 'inet_gethost_native.erl', line: 184]}]}}
State: {:state, :inet_gethost_native, :undefined, #PID<0.112.0>, {:local, :inet_gethost_native_sup}}
Hi @Adnatull! Are you by any chance behind a proxy or something that could be messing up the file contents?
Can you, for example, access https://repo.hex.pm/installs/hex-1.x.csv in your browser?
It is accessible from browser.
There is no proxy setup. I can remember that when I tried this command first it went well. Also I installed phoenix. But after that my Bitdefender antivirus detected something and deleted the threats automatically. After that, this symptoms show up whenever I try to install it.
Looking at the errors, it looks to me like the Erlang installation is broken and missing some files (in particular the inet_gethost 4 port driver). An antivirus deleting something sounds consistent with that.
Re-installed elixir and erlang. Moved to erlang 8.3. Previous problem is gone but now there is another issue. When I start the server following section shows up!
This site can鈥檛 be reached
The webpage at http://0.0.0.0:4000/ might be temporarily down or it may have moved permanently to a new web address.
ERR_ADDRESS_INVALID
elixir --version
Erlang/OTP 19 [erts-8.3] [64-bit] [smp:4:4] [async-threads:10]
Elixir 1.6.4 (compiled with OTP 19)
mix local.hex
Found existing entry: c:/Users/Masum/.mix/archives/hex-0.17.7
Are you sure you want to replace it with "https://repo.hex.pm/installs/1.6.0/hex-0.17.7.ez"? [Yn] Y
* creating .mix/archives/hex-0.17.7
mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
Found existing entry: c:/Users/Masum/.mix/archives/phx_new
Are you sure you want to replace it with "https://github.com/phoenixframework/archives/raw/master/phx_new.ez"? [Yn] Y
* creating .mix/archives/phx_new
md5-ce5c3f50e11699804a6e4dba317a027b
mix phx.new hello1 --no-ecto --no-brunch
* creating hello1/config/config.exs
* creating hello1/config/dev.exs
* creating hello1/config/prod.exs
* creating hello1/config/prod.secret.exs
* creating hello1/config/test.exs
* creating hello1/lib/hello1/application.ex
* creating hello1/lib/hello1.ex
* creating hello1/lib/hello1_web/channels/user_socket.ex
* creating hello1/lib/hello1_web/views/error_helpers.ex
* creating hello1/lib/hello1_web/views/error_view.ex
* creating hello1/lib/hello1_web/endpoint.ex
* creating hello1/lib/hello1_web/router.ex
* creating hello1/lib/hello1_web.ex
* creating hello1/mix.exs
* creating hello1/README.md
* creating hello1/test/support/channel_case.ex
* creating hello1/test/support/conn_case.ex
* creating hello1/test/test_helper.exs
* creating hello1/test/hello1_web/views/error_view_test.exs
* creating hello1/lib/hello1_web/gettext.ex
* creating hello1/priv/gettext/en/LC_MESSAGES/errors.po
* creating hello1/priv/gettext/errors.pot
* creating hello1/lib/hello1_web/controllers/page_controller.ex
* creating hello1/lib/hello1_web/templates/layout/app.html.eex
* creating hello1/lib/hello1_web/templates/page/index.html.eex
* creating hello1/lib/hello1_web/views/layout_view.ex
* creating hello1/lib/hello1_web/views/page_view.ex
* creating hello1/test/hello1_web/controllers/page_controller_test.exs
* creating hello1/test/hello1_web/views/layout_view_test.exs
* creating hello1/test/hello1_web/views/page_view_test.exs
* creating hello1/.gitignore
* creating hello1/priv/static/css/app.css
* creating hello1/priv/static/js/app.js
* creating hello1/priv/static/robots.txt
* creating hello1/priv/static/js/phoenix.js
* creating hello1/priv/static/images/phoenix.png
* creating hello1/priv/static/favicon.ico
Fetch and install dependencies? [Yn] Y
* running mix deps.get
* running mix deps.compile
We are all set! Go into your application by running:
$ cd hello1
Start your Phoenix app with:
$ mix phx.server
You can also run your app inside IEx (Interactive Elixir) as:
$ iex -S mix phx.server
md5-ce5c3f50e11699804a6e4dba317a027b
cd hello1
mix phx.server
Compiling 12 files (.ex)
Generated hello1 app
[info] Running Hello1Web.Endpoint with Cowboy using http://0.0.0.0:4000
What happens if you try localhost:4000? I am closing this as it is no longer an Elixir issue but we can continue the discussions here.
Thanks @josevalim . The issue seems to be with 0.0.0.0:4000 address. localhost:4000 works perfectly.
IIRC That address is not a valid one and google chrome doesnt support it, you may try with other browser.
@Adnatull For note, 0.0.0.0 is not only an invalid address but in registering socket handlers (in almost any language) it is used for the 'bind to all' action, thus when something says 0.0.0.0 that means you can use any address or name that is bound to that system. :-)
mix deps.get
mix ecto.create && mix ecto.migrate
cd assets && npm install
mix phx.server
mix phx.server
[warn] Could not start Phoenix live-reload because we cannot listen to the file system.
You don't need to worry! This is an optional feature used during development to
refresh your browser when you save files and it does not affect production.
[info] Application phoenix_live_reload exited: Phoenix.LiveReloader.Application.start(:normal, []) returned an error: shutdown: failed to start child: Phoenix.LiveReloader.Application
** (EXIT) an exception was raised:
** (ErlangError) Erlang error: :enoent
erlang.erl:2080: :erlang.open_port({:spawn_executable, 'c:/Users/Masum/Documents/Phoenix/pakka/_build/dev/lib/file_system/priv/inotifywait.exe'}, [:stream, :exit_status, {:line, 16384}, {:args, ['--format', [37, 119, 1, 37, 101, 1, 37, 102], '--quiet', '-m', '-r', 'c:/Users/Masum/Documents/Phoenix/pakka']}, {:cd, "C:\\Users\\Masum\\AppData\\Local\\Temp"}])
(file_system) lib/file_system/backends/fs_windows.ex:114: FileSystem.Backends.FSWindows.init/1
(stdlib) gen_server.erl:328: :gen_server.init_it/6
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
** (Mix) Could not start application phoenix_live_reload: Phoenix.LiveReloader.Application.start(:normal, []) returned an error: shutdown: failed to start child: Phoenix.LiveReloader.Application
** (EXIT) an exception was raised:
** (ErlangError) Erlang error: :enoent
erlang.erl:2080: :erlang.open_port({:spawn_executable, 'c:/Users/Masum/Documents/Phoenix/pakka/_build/dev/lib/file_system/priv/inotifywait.exe'}, [:stream, :exit_status, {:line, 16384}, {:args, ['--format', [37, 119, 1, 37, 101, 1, 37, 102], '--quiet', '-m', '-r', 'c:/Users/Masum/Documents/Phoenix/pakka']}, {:cd, "C:\\Users\\Masum\\AppData\\Local\\Temp"}])
(file_system) lib/file_system/backends/fs_windows.ex:114: FileSystem.Backends.FSWindows.init/1
(stdlib) gen_server.erl:328: :gen_server.init_it/6
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
deps\cowlib\ebin\cow_date.beam is infected with Atc4
deps\ecto\lib\mix\tasks\ecto.drop.ex is infected with Atc4
deps\ecto\lib\ecto\query\builder\distinct.ex is infected with Atc4
deps\ecto\lib\ecto\repo\assoc.ex is infected with Atc4
_build\dev\lib\pakka\ebin\elixir.pakkaweb.usersocket.beam is infected with Atc4
_build\dev\lib\phoenix_ecto\ebin\elixir.phoenix.ecto.sql.sandbox.beam is infected with Atc4
_build\dev\lib\ecto\ebin\elixir.ecto.query.api.beam is infected with Atc4
c:\users\masum\appdata\local\clink\clink.log is infected with Atc4
deps\ecto\lib\ecto\query\builder\from.ex is infected with Atc4
deps\ecto\lib\ecto\uuid.ex is infected with Atc4
deps\poolboy\ebin\poolboy.beam is infected with Atc4
c:\program files\git\usr\bin\ls.exe is infected with Atc4
deps\ecto\integration_test\sql\transaction.exs is infected with Atc4
Above are only few of those detected files and antivirus is still detecting and moving them to quarantine.
@josevalim Please help me to sort the problem. I might have messed with something which causing the issue.
Following command doesn't even work now
mix phx.server
'erl.exe' is not recognized as an internal or external command,
operable program or batch file.
Bitdefender antivirus
That's a really bad antivirus, I would never ever recommend it.
It is that AV that is breaking the program though.
mix phx.server
'erl.exe' is not recognized as an internal or external command,
operable program or batch file.
Sounds like your AV broke erlang too. You really should only use good AV's (much as I find it odd, Microsoft's own AV is one of the best nowadays...). You may need to do some repair because of what that AV has broken.
Hi @Adnatull! Are you by any chance behind a proxy or something that could be messing up the file contents?
Can you, for example, access https://repo.hex.pm/installs/hex-1.x.csv in your browser?
How would one solve this behind a proxy?
Hi, I'm having this same problem.

Ubuntu 16.04
When I tried to run mix local.hex --force it resulted in:
** (Mix) request timed out after 60000ms
Could not install Hex because Mix could not download metadata at https://repo.hex.pm/installs/hex-1.x.csv.
I can access this https://repo.hex.pm/installs/hex-1.x.csv using a browser.
What can I do to solve this?
Thank you for your attention.
Do you have any environment variables set up for proxying? For example HTTP_PROXY or HTTPS_PROXY, also check them in lowercase .
Hi @ericmj
No, I do not. Also checked them in lowercase.
I noticed something, when I am at office it works, but when I am at home it does not.
The difference it's the internet provider...
At the moment I'm using the google DNS, but it did not solve my problem.
If you open iex and run :gen_tcp.connect('repo.hex.pm', 443, []) does it return successfully?
I'm at office right now, so the result is:

When I get home I'll run this again and share the result here.
Thank you for your time.
@ericmj @VSPPedro I ran into a similar issue.
I was able to connect via iex as mentioned above.
But needed to update hex: mix local.hex --force
Also need to refresh hex cache and get/recompile deps
And then complete the hackney upgrade, per https://github.com/benoitc/hackney/issues/591#issuecomment-535224828
Now I'm at home and the result is:

and when I run mix local.hex --force:

Most helpful comment
@ericmj @VSPPedro I ran into a similar issue.
I was able to connect via iex as mentioned above.
But needed to update hex: mix local.hex --force
Also need to refresh hex cache and get/recompile deps
And then complete the hackney upgrade, per https://github.com/benoitc/hackney/issues/591#issuecomment-535224828