Phoenix ignoring Hex install

I am very new to Phoenix/Elixir and I have a few projects on my local machine that have been working without a problem. After trying to do an ecto.load and adding psql to my environment variables I am unable to launch any mix tasks without a warning that Hex has not been detected.

Could not find Hex, which is needed to build dependency :phoenix
Shall I install Hex? (if running non-interactively, use "mix local.hex --force")

Selecting yes attempts to install Hex but produces the following error:

Could not find Hex, which is needed to build dependency :phoenix
Shall I install Hex? (if running non-interactively, use "mix local.hex --force") [Yn] y
** (File.Error) could not make directory (with -p) "p:/.mix/archives/hex-0.18.1": no such device or address
    (elixir) lib/file.ex:280: File.mkdir_p!/1
    (mix) lib/mix/tasks/archive.install.ex:105: Mix.Tasks.Archive.Install.install/3
    (mix) lib/mix/local/installer.ex:107: Mix.Local.Installer.local_install/3
    (mix) lib/mix/dep/loader.ex:168: Mix.Dep.Loader.with_scm_and_app/4
    (mix) lib/mix/dep/loader.ex:121: Mix.Dep.Loader.to_dep/3
    (elixir) lib/enum.ex:1314: Enum."-map/2-lists^map/1-0-"/2
    (mix) lib/mix/dep/loader.ex:336: Mix.Dep.Loader.mix_children/1
    (mix) lib/mix/dep/loader.ex:18: Mix.Dep.Loader.children/0

I’m not sure why it seems to be trying to install on my P:/ which is a personal share from my organisation. I do have an existing install of Hex at c:/Users/userprofile/Local/.hex which seems to being ignored by the application.

I have reverted the psql environment variable with no change in the result and I am unable to mix phx.server any of my projects at the moment. I’m a bit stuck!

Because either you have set MIX_HOME=p: or ~ does resolve to p: (I’m not sure how ~ is treated on windows, but my guess is, that its not at all and the BEAM tries to by looking at HOME). I’m not sure though why id worked previously. The easiest thing to do is to set up your MIX_HOME to poit to the correct folder.

1 Like

Have you seen this thread? Maybe it helps.

Would the correct folder be the .mix folder in the \c\users\userprofile.mix path or c\program files(x86)\elixir\bin?

Usually that in your userfolder, but in fact you can specify any that you are able to write in and that suites you and your backup strategy best (if there is any).

You guys were spot on about the Home variable. For some reason when I logged onto my PC at work our domain forces a change to the Home filepath.

Thanks for the help

1 Like