Hi, I am new to elixir and phoenix. On creating my first phoenix project, I am up with this error. I was covering the steps that has been mentioned in the phoenix doc.
On running mix ecto.create command I am getting this error. I am using MacBook Pro M1 and have installed elixir through Homebrew. The elixir Iex interactive shell was running fine.
sanjeet@Sanjeets-MacBook-Pro hello % mix ecto.create
20:20:34.945 [info] Compiling file system watcher for Mac...
==> file_system
sh: line 0: exec: sh: not found
20:20:34.956 [error] Could not compile file system watcher for Mac, try to run "clang -framework CoreFoundation -framework CoreServices -Wno-deprecated-declarations c_src/mac/*.c -o priv/mac_listener" manually inside the dependency.
Compiling 7 files (.ex)
Generated file_system app
==> connection
Compiling 1 file (.ex)
Generated connection app
==> gettext
Compiling 1 file (.yrl)
Compiling 1 file (.erl)
Compiling 20 files (.ex)
Generated gettext app
sh: line 0: exec: sh: not found
==> hello
** (Mix) Could not compile dependency :ranch, "/Users/sanjeet/.mix/rebar3 bare compile --paths /Users/sanjeet/Documents/elixir-demo/hello/_build/dev/lib/*/ebin" command failed. You can recompile this dependency with "mix deps.compile ranch", update it with "mix deps.update ranch" or clean it with "mix deps.clean ranch"
sanjeet@Sanjeets-MacBook-Pro hello %
Got same error after running the above above commands.
22:17:00.473 [info] Compiling file system watcher for Mac...
==> file_system
sh: line 0: exec: sh: not found
22:17:00.483 [error] Could not compile file system watcher for Mac, try to run "clang -framework CoreFoundation -framework CoreServices -Wno-deprecated-declarations c_src/mac/*.c -o priv/mac_listener" manually inside the dependency.
Compiling 7 files (.ex)
Generated file_system app
==> connection
Compiling 1 file (.ex)
Generated connection app
==> gettext
Compiling 1 file (.yrl)
Compiling 1 file (.erl)
Compiling 20 files (.ex)
Generated gettext app
sh: line 0: exec: sh: not found
==> hello
** (Mix) Could not compile dependency :ranch, "/Users/sanjeet/.mix/rebar3 bare compile --paths /Users/sanjeet/Documents/elixir-demo/hello/_build/dev/lib/*/ebin" command failed. You can recompile this dependency with "mix deps.compile ranch", update it with "mix deps.update ranch" or clean it with "mix deps.clean ranch"
sanjeet@Sanjeets-MacBook-Pro hello %
I got this exact issue, and the above suggestions didn’t help.
What did help (as suggested by a friendly person in IRC) was (I think) fixing my PATH variable. I didn’t see any issues with it when I looked at it, but once I had fixed some duplicated and broken PATH-relevant lines in my .zshrc, it started working.
I wasn’t able to make it break again by putting it back to how it was (I should have saved my exact .zshrc so I could do science) so I can’t say exactly what the issue was.
Here’s what the PATH variable looks like now: /usr/local/opt/node@12/bin:/Users/dan/.rbenv/shims:/Users/dan/.cargo/bin:/Users/dan/bin:/usr/local/opt/openssl/bin:/Users/dan/.cargo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/dan/.rvm/bin
There isn’t much relevant to Elixir, so I truly don’t know what the problem was… Hope this is at all helpful to someone in the future!