Module not loaded/could not be found

I generated a context for a basic project, updated a few things in my router, created a live file for my liveviews and ran into this error


== Compilation error in file lib/wishlist_web/templates/live/show_live.ex ==
** (CompileError) lib/wishlist_web/templates/live/show_live.ex:2: module WishListWeb 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     
    (elixir 1.12.3) expanding macro: Kernel.use/2
    lib/wishlist_web/templates/live/show_live.ex:2: WishListWeb.ShowLive (module)

router

  scope "/admin", WishlistWeb do
    pipe_through :browser

    live "/edit", EditLive, :root
  end

edit_live.ex (excluding mount and render b/c i know that can’t be the issue.)

defmodule WishListWeb.EditLive do
  use WishListWeb, :live_view

i tried recompiling, deleting _build, and even recreating the project, based off similar issues i found online. Could you point me in the right direction?

I see a typo in your router file. “WishlistWeb” instead of “WishListWeb”.

1 Like

What is the module name in your lib/wishlist_web.ex file?

You should probably be using WishlistWeb, not WishListWeb in your EditLive and ShowLive modules.

Reason I’m assuming it this way is that Phoenix will name the file with module MyAppWeb as my_app_web.ex, it converts CamelCase names to came_case files.

i.e.

2 Likes

awesome thank you much juan!