Erlang error: :enoent when trying mix deps.get

I am trying to create a new Phoenix app with mix phx.new app_name and it return this error message when trying to execute mix deps.get:

* running mix deps.get
** (ErlangError) Erlang error: :enoent
    (elixir 1.18.2) lib/system.ex:955: System.do_shell("mix deps.get", [stderr_to_stdout: true, into: %Mix.Shell{callback: #Function<1.89169521/1 in Mix.Shell.cmd/3>}])
    (mix 1.18.2) lib/mix/shell.ex:137: Mix.Shell.cmd/3
    lib/mix/tasks/phx.new.ex:385: Mix.Tasks.Phx.New.cmd/3
    lib/mix/tasks/phx.new.ex:275: anonymous fn/5 in Mix.Tasks.Phx.New.prompt_to_install_deps/3
    (elixir 1.18.2) lib/file.ex:1665: File.cd!/2
    lib/mix/tasks/phx.new.ex:205: Mix.Tasks.Phx.New.run/1
    (mix 1.18.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.18.2) lib/mix/cli.ex:107: Mix.CLI.run_task/2

phx.new v1.8.0-rc.3 (the same happens to v1.8.0-rc.1).

Here is my Erlang and Elixir versions:

elixir -v                                     
Erlang/OTP 27 [erts-15.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit] [dtrace]

Elixir 1.18.2 (compiled with Erlang/OTP 27)

Using macOS Sequoia 15.5. It might be helpful to inform that I upgraded it yesterday.

Does anybody is facing the same issue?

I don’t know anything about the issue but you should include your phx_new version as well in case it matters. mix phx.new -v should do it.

1 Like

The best I have for you is that enoent means a file is missing. Does running mix deps.get by itself from the project directory offer anything different that might give us a clue?

1 Like

Ah yes.

It works when running mix deps.get from the project directory. But once inside the project directory, I try the iex -S mix phx.server, returns:

13:08:56.991 [info] Compiling file system watcher for Mac...
==> file_system
could not compile dependency :file_system, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile file_system --force", update it with "mix deps.update file_system" or clean it with "mix deps.clean file_system"
** (ErlangError) Erlang error: :enoent
    (elixir 1.18.2) lib/system.ex:955: System.do_shell("xcrun -r clang   -framework CoreFoundation -framework CoreServices -Wno-deprecated-declarations c_src/mac/*.c -o priv/mac_listener", [stderr_to_stdout: true, into: %Mix.Shell{callback: #Function<0.35548712/1 in Mix.Shell.IO.cmd/2>}])
    (mix 1.18.2) lib/mix/shell.ex:137: Mix.Shell.cmd/3
    /Users/dhonysilva/estudos/blocksanalytics/deps/file_system/mix.exs:67: FileSystem.MixProject.compile_mac/0
    (mix 1.18.2) lib/mix/task.ex:574: Mix.Task.run_alias/6
    (mix 1.18.2) lib/mix/tasks/compile.all.ex:117: Mix.Tasks.Compile.All.run_compiler/2
    (mix 1.18.2) lib/mix/tasks/compile.all.ex:97: Mix.Tasks.Compile.All.compile/4
    (mix 1.18.2) lib/mix/tasks/compile.all.ex:71: Mix.Tasks.Compile.All.do_run/2
    (mix 1.18.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5

Yeah this is a Mac issue - This might be helpful (though its old) : Live-reload troubles: Compiling file system watcher for Mac - #8 by OvermindDL1 ; if not, hopefully a Mac user is online :smiley:

1 Like

The offending line is here, implying your system doesn’t have sh. What happens if you open up a terminal window and type which sh?

This is the result:

% which sh
/bin/sh

That looks correct, so I think we’re going to need somebody who knows what :os.find_executable() actually does (not me). But out of curiosity, what happens if you run this in iex?

:os.find_executable(~c"sh")

Interesting :thinking:

iex(1)> :os.find_executable(~c"sh")
false
1 Like

It might be helpful to inform that I upgraded the macOS Sequoia 15.5 yesterday.

1 Like

Have you tried reinstalling both Erlang and Elixir? Something like this happened to my Ruby env once. It stopped working after a macOS update but a quick reinstall fixed it.

2 Likes

It worked with Erlang version 28. I’ll update the asdf.

Thanks :grinning_face:

2 Likes