Fresh install + new project + mix test causes crash (1.14.3)

I’ve come back to Elixir after a year away. MacOS 12.4, M1 chip. Upgraded (see below for details).

After a mix new, I cd into the project and type mix test, to this result:

** (MatchError) no match of right hand side value: {:error, {{:EXIT, {:function_clause, [{:disk_log_sup, :start_link, [], [file: 'disk_log_sup.erl', line: 26]}, {:supervisor, :do_start_child_i, 3, [file: 'supervisor.erl', line: 414]}, {:supervisor, :do_start_child, 2, [file: 'supervisor.erl', line: 400]}, {:supervisor, :handle_start_child, 2, [file: 'supervisor.erl', line: 706]}, {:supervisor, :handle_call, 3, [file: 'supervisor.erl', line: 455]}, {:gen_server, :try_handle_call, 4, [file: 'gen_server.erl', line: 1149]}, {:gen_server, :handle_msg, 6, [file: 'gen_server.erl', line: 1178]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 240]}]}}, {:child, :undefined, :disk_log_sup, {:disk_log_sup, :start_link, []}, :permanent, false, 1000, :supervisor, [:disk_log_sup]}}}
    (kernel 8.5.4) disk_log_server.erl:142: :disk_log_server.ensure_started/0
    (kernel 8.5.4) disk_log_server.erl:52: :disk_log_server.open/1
    (stdlib 4.3) ets.erl:815: :ets.tab2file/3
    (mix 1.14.3) lib/mix/compilers/application_tracer.ex:220: Mix.Compilers.ApplicationTracer.write_manifest/1
    (mix 1.14.3) lib/mix/compilers/application_tracer.ex:41: Mix.Compilers.ApplicationTracer.prepare/2
    (mix 1.14.3) lib/mix/compilers/elixir.ex:150: Mix.Compilers.Elixir.compile/7
    (mix 1.14.3) lib/mix/state.ex:15: Mix.State.lock/2
    (mix 1.14.3) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4

I’m wondering if this is some sort of permissions thing? Or if there’s crud from an earlier installation lying around somewhere?

Also note this:

528 $ mix help
** (FunctionClauseError) no function clause matching in Mix.Tasks.Iex.__info__/1    
    
    The following arguments were given to Mix.Tasks.Iex.__info__/1:
    
        # 1
        :attributes
    
    (mix 1.14.3) Mix.Tasks.Iex.__info__/1
    (mix 1.14.3) lib/mix/tasks/help.ex:178: anonymous fn/2 in Mix.Tasks.Help.build_task_doc_list/1
    (elixir 1.14.3) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
    (mix 1.14.3) lib/mix/tasks/help.ex:171: Mix.Tasks.Help.build_doc_list/2
    (mix 1.14.3) lib/mix/tasks/help.ex:50: Mix.Tasks.Help.run/1
    (mix 1.14.3) lib/mix/task.ex:421: anonymous fn/3 in Mix.Task.run_task/4
    (mix 1.14.3) lib/mix/cli.ex:84: Mix.CLI.run_task/2

mix help works outside of the new project directory.


Did this sequence of commands to get the above results.

> rm -rf ~/.mix*
> brew uninstall elixir erlang
> brew install elixir
> elixir --version
Erlang/OTP 25 [erts-13.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns] [dtrace]

Elixir 1.14.3 (compiled with Erlang/OTP 25)
> mix new first
> cd first
> mix test

I don’t see anything weird in my .bashrc, etc. files, and the PATH seems right:

509 $ whereis mix
mix: /usr/local/bin/mix /usr/local/share/man/man1/mix.1
510 $ ls -l /usr/local/bin/mix
lrwxr-xr-x  1 bem  admin  31 Mar 15 13:19 /usr/local/bin/mix@ -> ../Cellar/elixir/1.14.3/bin/mix
2 Likes

Hi Brian, that is puzzling and annoying. My hypothesis is that:-

  1. There’s something messed up with the Brew Elixir formula - it’s bundling a wrong .beam file in or something, but I’ve really no idea.
  2. No-one uses Brew to install Elixir any more so nobody else has noticed.

If you want to run with the crowd, I’d say that most people use Asdf these days, which builds Erlang from source. That said building Erlang can be fiddly: pay close attention to the suggested prerequisites for the Erlang plugin. Also you need to match the Elixir with the Erlang. Eg choose elixir 1.14.3-otp-25 to go with Erlang 25.

1 Like

I’ve used brew to install and haven’t had issues.

Any dependencies? Did you try running
‘Mix deps.get’ first?

I tried mix deps.get. It didn’t make a difference.

However, I installed macports and installing elixir+erlang from there works. I guess I’ll just have to remember what comes from homebrew and what comes from macports.

So I guess it’s some Homebrew ↔ my machine interaction. I could do more digging at the request of [[someone]], but I don’t know who that someone would be or what information would help them.

I tried replicating it on my mac to no avail but I do have an intel chip. Sorry I couldn’t be more help!

1 Like