Command mix help fails - (Code.LoadError) could not load /Users/config/config.exs

For some reason mix help doesn’t work outside the project directory, for install if create a directory on ~/Sandbox cd and try to run mix help it fails with

mix help
** (Code.LoadError) could not load /Users/config/config.exs
    (elixir) lib/code.ex:1147: Code.find_file/2
    (elixir) lib/code.ex:706: Code.eval_file/2
    (mix) lib/mix/config.ex:220: Mix.Config.eval!/2
    (mix) lib/mix/tasks/loadconfig.ex:38: Mix.Tasks.Loadconfig.load/1
    (mix) lib/mix/tasks/loadconfig.ex:28: Mix.Tasks.Loadconfig.run/1
    (mix) lib/mix/task.ex:331: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:78: Mix.CLI.run_task/2

My env

MacOs

Darwin Machine.local 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

Erlang/OTP 22 [erts-10.4] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Elixir 1.8.2 (compiled with Erlang/OTP 21)

@eduardonunesp

You have: Erlang/OTP 22 and Elixir 1.8.2 (compiled with Erlang/OTP 21). Please make sure Elixir is compiled with your current Erlang/OTP version. In some cases it could cause some problems.

Can you please tell us how did you installed Erlang and Elixir. If not using asdf version manager (which I know and use right now) please check if same happens in asdf.

I’m not sure why Elixir is trying to open config/config.exs. Did you run mix help inside your project? If so did you tried to run outside it or in newly generated one?

1 Like

Switched to ERL 21 and the error persists

➜  Sandbox erl -v
Erlang/OTP 21 [erts-10.3.5.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe] [dtrace]

Eshell V10.3.5.1  (abort with ^G)

I have installed with brew, first installed brew install elixir and brew installed erlang 22

Yes I have run mix help inside a project it works, but I trying to create another project and all commands fail outside the project dir with the same error

Do you have something in your ~/.iex.exs that is specific to that specific project?

No and the file ~/.iex.exs don’t exists on home dir

But is there probably a ~/mix.exs?

Can you try running: find / -name .iex.exs 2>/dev/null and find / -name mix.exs 2>/dev/null. I’m assuming there’s one of those (probably mix.exs) in a location that you don’t expect. Possibly in /Users

2 Likes

Nope, there’s no ~/mix.exs

Yes, as @axelson wrote, chances for a /User/mix.exs are much higher… I have read the error message wrong when I first wrote my post.

Yep I just double checked the /Users and there’s no file /Users/mix.exs and /User directory

Guys, I going to reinstall Elixir and Phoenix cleanup all iex.exs and mix.exs files, it should be ok all projects are on version control, thanks

Have you tried the find commands @axelson suggested? Are there any in the list, that do not belong to any of your projects?

Yep I did, but all mix.exs and iex.exs files are inside the projects folders, so I’ll wipe out the installation

Just a blind guess… find will do a case sensitive search, while the Mac OS filesystem will find MIX.exs when asked for mix.exs… Is there anything in /Users that is not your $HOME?

Thanks guys for your help, after cleanup all iex.exs and mix.exs and brew reinstall elixir it works, also I noticed that the elixir version was older (and this is not my desktop, just helping a friend here to fix his elixir installation :wink:), at least he can start to get his hands dirty on some Elixir/Phoenix

3 Likes