Alex-Njoroge
Hello everyone I have an issue.
I am creating a simple blogapp with a minimal frontend in phoenix liveview but I keep getting this error in my layouts.ex file.
mix compile
Compiling 3 files (.ex)
error: module Phoenix.LiveView.HTML is not loaded and could not be found
lib/blogapp_web/components/layouts.ex:8: BlogappWeb.Layouts (module)
== Compilation error in file lib/blogapp_web/components/layouts.ex ==
** (CompileError) lib/blogapp_web/components/layouts.ex: cannot compile module BlogappWeb.Layouts (errors have been logged)
This is how my layouts.ex file looks like
defmodule BlogappWeb.Layouts do
@moduledoc """
This module holds different layouts used by your application.
"""
use BlogappWeb, :html
import Phoenix.HTML
import Phoenix.LiveView.HTML -( The error occurs in this line - module Phoenix.LiveView.HTML is not loaded and could not be found. This may be happening because the module you are trying to load directly or indirectly depends on the current module)
embed_templates "layouts/*"
end
You help is deeply appreciated.
Trending in Questions
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
Hi everyone,
I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding.
I sta...
New
Hello,
I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
Documentation
While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
So my question is quite simple and i have found no conclusive answer on forum, google or AI.
Should we use :erlang.float for Integer to ...
New
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New
Other Trending Topics
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
I am happy to introduce the very α version of the new programming language compiled to BEAM.
Welcome Cure.
It has literally three kille...
New
Hi there! We created Gust: A task orchestrator inspired by Airflow.
For those who have never heard about Aiflow, it’s a Python-based wor...
New
Hi everyone!
The first release candidate for the Expert language server project is now available!
We’ve published a press release detai...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #elixirconf-eu
- #metaprogramming
- #hex











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
benwilson512
Hi @Alex-Njoroge to answer this sort of question we need some basic information:
mix deps|grep phoenix, we need to know which versions of Phoenix and Phoenix LiveView are you running.Alex-Njoroge
mix deps|grep phoenix
locked at 1.7.14 (phoenix) c7859bc5
locked at 4.6.2 (phoenix_ecto) 3f94d025
locked at 4.1.1 (phoenix_html) f2f2df5a
locked at 0.8.4 (phoenix_live_dashboard) 2984aae9
locked at 1.5.3 (phoenix_live_reload) b4ec9cd7
locked at 1.0.0-rc.6 (phoenix_live_view) e56e4f16
locked at 2.1.3 (phoenix_pubsub) bba06bc1
locked at 1.0.4 (phoenix_template) 2c0c81f0
Here are the steps for creating the blog app
Create a new Phoenix project:
Ran
mix phx.new blogapp --liveto scaffold a new Phoenix LiveView project.Install dependencies
Jumped into the project directory with
cd blogappand ranmix deps.getto fetch all necessary dependencies.Configure the database
Updated
config/dev.exsto use MySQL with the appropriate credentials.Created and migrated the database with
mix ecto.createandmix ecto.migrate.Update project dependencies
Added and updated necessary dependencies in
mix.exsincluding Phoenix LiveView and Phoenix HTMLCreate and customize templates and components
Set up
.heextemplates and LiveView components for various parts of the app like layouts, navigation, and content areas.Resolve CSRF and LiveView imports
Imported
Plug.CSRFProtectionfor CSRF protection in forms and templates.Updated
lib/blogapp_web/components/layouts.ex:Added
use Phoenix.Componentfor live component support.Imported
Phoenix.LiveView.HelpersandPhoenix.HTMLto use functions likecsrf_meta_tag.benwilson512
As a quick sanity check, can you
rm -rf _buildand try a clean build from there?sigu
Hello @Alex-Njoroge , the extra step of importing the helpers on the layouts file might not be necessary as phoenix already imports the helpers by default. Here is the default
lib/blogapp_web.exfile which includes the helpersWas there any specific reason you wanted to include the
Phoenix.LiveView.HTMLmodule?Alex-Njoroge
Yes, I tried this as well but the errors keep persisting.
Alex-Njoroge
Hello Sigu. It’s great to see you in this side as well.
I dont have a specific reason for using the
Phoenix.LiveView.HTMLmodule. The frontend for the blogapp was not working and I was just trying a couple of options to make it work. It was a suggestion from chatgpt and I went with it.Alex-Njoroge
If there is a way you can suggest for me to successfully implement the frontend, I would greatly appreciate.
sigu
That response from gpt is from old version of liveview before it was intergrated into the phkenix generator.
Cal you provide the error you are trying to solve?
Alex-Njoroge
these were the errors I was getting
mix compile
Compiling 2 files (.ex)
error: module Phoenix.LiveView.HTML is not loaded and could not be found
lib/blogapp_web/layouts.ex:13: BlogappWeb.Layouts (module)
== Compilation error in file lib/blogapp_web/layouts.ex ==
** (CompileError) lib/blogapp_web/layouts.ex: cannot compile module BlogappWeb.Layouts (errors have been logged)
Alex-Njoroge
Here is the code in the
lib/blogapp_web/layouts.exfiledefmodule BlogappWeb.Layouts do
@moduledoc “”"
This module holds different layouts used by your application.
See the
layoutsdirectory for all templates available.The “root” layout is a skeleton rendered as part of the
application router. The “app” layout is set as the default
layout on both
use BlogappWeb, :controlleranduse BlogappWeb, :live_view.“”"
use BlogappWeb, :html
import Phoenix.HTML
import Phoenix.LiveView.HTML - The error is here in the import Phoenix.LiveView.HTML
embed_templates “layouts/*”
end