Programming Phoenix LiveView B8: Page 20: Bug in instructions

The introduction instructions under section “Build a Simple LiveView” are incomplete. If followed from book one gets the following error:

[error] #PID<0.745.0> running Phoenix.Endpoint.SyncCodeReloadPlug (connection #PID<0.659.0>, stream id 9) terminated
Server: localhost:4000 (http)
Request: GET /guess
** (exit) an exception was raised:
    ** (ArgumentError) no "live" html template defined for PentoWeb.LayoutView
        (phoenix_template 1.0.1) lib/phoenix/template.ex:241: Phoenix.Template.render_with_fallback/4

This is because (I think) we put “live.html” in the following line on page 16:

use Phoenix.LiveView, layout: {PentoWeb.LayoutView, "live.html"}

I think it should be changed to/modified to the following:

use Phoenix.LiveView

So the control is directly passed to the render function, rather than asking it to look for a live.html.

What version of phoenix are you using? The current B8 of the book I think is based on phoenix 1.5 and LiveView < 0.18. As a result, there may be a lot of code that is incorrect if you’re using Phoenix 1.7 (the latest release).

@SophieDeBenedetto has mentioned on a few threads that they are just about to release B9 of the book which is being updated for the current versions of Phoenix & LiveView. :tada: At this point you may want to wait on the book until B9 has dropped.


Thanks @schlenks , I am indeed using a newer version:

phoenix 1.7.1
Liveview 1.18

No worries, and Thanks again!