Nerves environment: (mix nerves.env --info): MIX_TARGET: rpi3, MIX_ENV: dev
Current behavior
When following the tutorial line by line, running mix deps.get in my_app_firmware results in the following error:
Dependencies have diverged:
* phoenix (Hex package)
the :targets option for dependency phoenix
> In /Users/michael/Programming/my_app/my_app_ui/mix.exs:
{:phoenix, "~> 1.7.11", [targets: [:rpi, :rpi0, :rpi2, :rpi3, :rpi3a, :rpi4, :bbb, :osd32mp1, :x86_64, :grisp2, :mangopi_mq_pro], env: :prod, hex: "phoenix", repo: "hexpm"]}
does not match the :targets option calculated for
> In deps/phoenix_live_reload/mix.exs:
{:phoenix, "~> 1.4", [only: :dev, targets: [:host], env: :prod, hex: "phoenix", repo: "hexpm", optional: false]}
Ensure you specify at least the same targets in :targets in your dep
** (Mix) Can't continue due to errors on dependencies
This can be fixed by doing {:my_app_ui, path: "../my_app_ui", targets: [:host | @all_targets], env: Mix.env()}, in my_app_firmware/mix.exs (note [:host | @all_targets] instead of targets: @all_targets).
However, after doing this RingLogger.next reveals a new error when starting the server:
MyAppUi.Application.start(:normal, []) returned an error: shutdown: failed to start child: MyAppUiWeb.Endpoint
** (EXIT) an exception was raised:
** (UndefinedFunctionError) function Plug.Cowboy.child_spec/1 is undefined (module Plug.Cowboy is not available)
Plug.Cowboy.child_spec([ref: MyAppUiWeb.Endpoint.HTTP, scheme: :http, plug: {MyAppUiWeb.Endpoint, []}, options: [port: 80, otp_app: :my_app_ui]])
(phoenix 1.7.11) lib/phoenix/endpoint/cowboy2_adapter.ex:92: Phoenix.Endpoint.Cowboy2Adapter.child_spec/4
(phoenix 1.7.11) lib/phoenix/endpoint/cowboy2_adapter.ex:66: anonymous fn/5 in Phoenix.Endpoint.Cowboy2Adapter.child_specs/2
(elixir 1.16.1) lib/enum.ex:2528: Enum."-reduce/3-lists^foldl/2-0-"/3
(phoenix 1.7.11) lib/phoenix/endpoint/cowboy2_adapter.ex:56: Phoenix.Endpoint.Cowboy2Adapter.child_specs/2
(phoenix 1.7.11) lib/phoenix/endpoint/supervisor.ex:88: Phoenix.Endpoint.Supervisor.init/1
(stdlib 5.2) supervisor.erl:330: :supervisor.init/1
(stdlib 5.2) gen_server.erl:980: :gen_server.init_it/2
This error occurs because mix phx.new creates a project with bandit instead of plug_cowboy. To resolve this issue, people need to add adapter: Bandit.PhoenixAdapter to my_app_/my_app_firmware/config/target.exs
Expected behavior
The tutorial to work when following all the instructions
Environment
elixir -v
):1.16.1
mix nerves.env --info
):MIX_TARGET: rpi3
,MIX_ENV: dev
Current behavior
When following the tutorial line by line, running
mix deps.get
inmy_app_firmware
results in the following error:This can be fixed by doing
{:my_app_ui, path: "../my_app_ui", targets: [:host | @all_targets], env: Mix.env()},
inmy_app_firmware/mix.exs
(note[:host | @all_targets]
instead oftargets: @all_targets
).However, after doing this
RingLogger.next
reveals a new error when starting the server:This error occurs because
mix phx.new
creates a project withbandit
instead ofplug_cowboy
. To resolve this issue, people need to addadapter: Bandit.PhoenixAdapter
tomy_app_/my_app_firmware/config/target.exs
Expected behavior
The tutorial to work when following all the instructions