APB9785
I’ve been re-arranging my code to break a larger LiveView app into smaller Live Components based on separation of concerns. In the main app I alias the component module name (BoardComponent), then render:
<%= live_component @socket, BoardComponent,
active_user: @active_user,
user_cache: @user_cache,
active_board: @active_board %>
I’ve done this with several different components so far, with no problems. But after doing a little work today, I’m suddenly getting hit with
** (UndefinedFunctionError) function MyAppWeb.BoardComponent.__live__/0 is undefined (module MyAppWeb.BoardComponent is not available)
But not just for the BoardComponent… when I try to access a different one - same exact error:
** (UndefinedFunctionError) function MyAppWeb.PostComponent.__live__/0 is undefined (module MyAppWeb.PostComponent is not available)
Even components that were not even touched by today’s work, for some reason are “not available”. And it’s really strange.. After reloading and recompiling a few times, I can get some modules to work but not others… and I’m not changing the code AT ALL - just killing and restarting mix phx.server gives different results each time.
Any ideas what could be going on? I didn’t really make any major changes today.
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex











First 10 of 16 Posts
petelacey
Are you perhaps still using
use Phoenix.LiveViewwhen you should now be usinguse Phoenix.LiveComponent?APB9785
I’m using
APB9785
I fixed my own issue by making non-changes
e.g.
{:ok, socket}to:doing that one-by-one for all my components, and Elixir then recompiled the files and now there are no errors. Even if I revert the changes back to
{:ok, socket}it still works. Very strange…benwilson512
@APB9785 sounds like something in your
_builddirectory got weird. While I generally find that compiler issues with Elixir are rare, when they do happen, they are generally fixed for me by doingrm -rf _buildExadra37
Did you by any chance compiled the code or ran the app with different versions of Elixir:
asdfto run the app with different Elixir version?If you have done this then the
_buildfolder get’s itself in a weird state. Also when trying out new versions of Elixir you may end-up with incompatible versions in yourmix.lockanddepsfolder.APB9785
Thanks for the info! But in this case, I didn’t do anything with docker or asdf. I was just moving around some
handle_event/3clauses after separating a settings menu into its own LC.Exadra37
So it seems that your solution is to do what is suggested here
If you could replicate the issue in a sample Phoenix repo then you could open a bug report for the Elixir compiler.
jerdew
I just came across this same error message and I don’t think I touched the code between working and not-working states. Walked away from the computer with no compile errors, came back and refreshed a webpage on localhost and it gave the same error as OP. I commented out a couple uncommitted changes (a route and the live_view file for that route) to remove all unstaged edits to get back to the commit that I’m sure was working, and the error persisted.
Nuked the
_buildto get back to working before wondering if this was an error with a resolution. Are there useful commands/spelunking to do when a_buildfolder gets into a confused state?elifous
I had exactly the same problem after some formatting changes at the
live_componentcall. Deleting_builddid not solve it. After deletingnode_modules/.cachethe error was gone. I also noticed some minor CSS issues also solved after deleting.ghenry
Deleting _build worked for me after copying an existing live module to a new file name.