I am try to use observer in phoenix server, but errors throw:
$iex -S mix phx.server
iex(1)> :observer.start()
** (UndefinedFunctionError) function :observer.start/0 is undefined (module :observer is not available)
:observer.start()
iex:1: (file)
version:
iex -v
IEx 1.15.4 (compiled with Erlang/OTP 26)
This is due to code path pruning introduced in Elixir 1.15.
if you have an application or dependency that does not specify its dependencies on Erlang and Elixir application, it may no longer compile successfully in Elixir v1.15
The fix is to add :observer
, :wx
, and :runtime_tools
to your list of extra_applications
in mix.exs
.
It’s a bit strange that we need to opt-in to something in a mix project that’s already available by default in vanilla iex
, though.