Mix phx.new --live failing when running phx.server

I am learning LiveView with Phoenix 1.7rc0, redoing some of the steps made me create a new project that is only --live. When i do that the css is not found and the page is completely empty

 mix phx.new --live rhema
* creating ,...
* creating rhema/priv/static/favicon.ico

Fetch and install dependencies? [Yn] y
* running mix deps.get
* running mix deps.compile

We are almost there! The following steps are missing:

    $ cd rhema

Then configure your database in config/dev.exs and run:

    $ mix ecto.create

Start your Phoenix app with:

    $ mix phx.server

You can also run your app inside IEx (Interactive Elixir) as:

    $ iex -S mix phx.server

sergio@Chargios-Max Elixir % cd rhema
sergio@Chargios-Max rhema % mix ecto.create
miCompiling 15 files (.ex)
x phx.seGenerated rhema app
The database for Rhema.Repo has been created
sergio@Chargios-Max rhema % mix phx.server
[info] Running RhemaWeb.Endpoint with cowboy 2.9.0 at (http)
[debug] Downloading tailwind from https://github.com/tailwindlabs/tailwindcss/releases/download/v3.1.8/tailwindcss-macos-arm64
[debug] Downloading esbuild from https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.41.tgz
[info] Access RhemaWeb.Endpoint at http://localhost:4000
[watch] build finished, watching for changes...
[watch] build started (change: "js/app.js")
[watch] build finished
[info] GET /
[debug] Processing with RhemaWeb.PageController.home/2
  Parameters: %{}
  Pipelines: [:browser]
[debug] Plug.Session could not verify incoming session cookie. This may happen when the session settings change or a stale cookie is sent.
[info] Sent 200 in 68ms
[info] GET /assets/app.css
[debug] ** (Phoenix.Router.NoRouteError) no route found for GET /assets/app.css (RhemaWeb.Router)
    (rhema 0.1.0) lib/phoenix/router.ex:481: RhemaWeb.Router.call/2
    (rhema 0.1.0) lib/rhema_web/endpoint.ex:1: RhemaWeb.Endpoint.plug_builder_call/2
    (rhema 0.1.0) lib/plug/debugger.ex:136: RhemaWeb.Endpoint."call (overridable 3)"/2
    (rhema 0.1.0) lib/rhema_web/endpoint.ex:1: RhemaWeb.Endpoint.call/2
    (phoenix 1.7.0-rc.0) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
    (plug_cowboy 2.6.0) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2
    (cowboy 2.9.0) /Users/sergio/workspace/Elixir/rhema/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
    (cowboy 2.9.0) /Users/sergio/workspace/Elixir/rhema/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
    (cowboy 2.9.0) /Users/sergio/workspace/Elixir/rhema/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
    (stdlib 4.1.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

Done in 129ms.

The ouput is a blank page:

Looks like a bug, as this is everything out of the box

Could you try again without --live? I believe that’s no longer necessary to wire up LiveView. It used to be necessary to pull in those dependencies.

That doesn’t explain why assets/app.css isn’t being created but if it were me I’d create a new project one more time. If it happens again then you’ve confirmed you’re recreating the problem. It’s also possible you had a hiccup downloading dependencies or a weird compile that could be fixed by deleting deps/ and _build/ then running mix deps.get and mix phx.server again.

You could always try that first but a new project will verify it’s isolated to this one and you can tinker with it if you want, or just use the new one.

I found that it took a good few seconds/repeated runs when first running 1.7 for the assets to be loaded.


I’ve tried again as you suggested, without the ‘–live’ and with it again.

My test worked without --live, but only the second time I tried.

mix phx.server

Ctrl-c + Ctrl-c

mix phx.server

the first time I got the same error, the second time it worked. Then I tried with --liveagain and it worked, generating the same config that without --live

It could be an unreliable connection while I was creating it, altought I didn’t see any error or warnings, while today I am trying with a good connection