How to configure location for .hex folder? ((File.Error) could not make directory (with -p))

When running mix deps.get I get the following error:

[error] Task #PID<0.223.0> started from :hex_fetcher terminating
** (File.Error) could not make directory (with -p) "h:/.hex/packages/hexpm": no such file or directory
    (elixir) lib/file.ex:271: File.mkdir_p!/1
    (hex) lib/hex/scm.ex:302: Hex.SCM.fetch/5
    (elixir) lib/task/supervised.ex:88: Task.Supervised.do_apply/2
    (elixir) lib/task/supervised.ex:38: Task.Supervised.reply/5
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3

It tries to write to h:/ even though I have set the HOME environment variable to

iex> System.get_env(“HOME”)
“C:\Users\USER”

Which config or environment variable needs to be set to use the user home location?

I am using Windows 10, Git bash logged in as Admin,
Erlang/OTP 20 [erts-9.2] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10]
Elixir 1.6.4 (compiled with OTP 19)

Hex home can be configured by setting HEX_HOME.

You can run mix help hex.config or see https://hex.pm/docs/tasks#hex_config for other configuration options. (we’ve just updated that link to mention HEX_HOME :sweat_smile:)

1 Like

Thank you!