I was working in Phoenix/Elixir and created a function component for navbar, and got this issue:
Done in 38ms.
Compiling 1 file (.ex)
error: undefined function sigil_p/2 (expected RankgistWeb.NavComponents to define such a function or for it to be imported, but none are available)
│
55 │ href={~p"/users/log_out"}
│ ^^^^^^^^^^^^^^^^^^^^^^^^^
│
└─ (rankgist 0.1.0) lib/rankgist_web/components/nav_components.ex:55: RankgistWeb.NavComponents.main/1
error: undefined function sigil_p/2 (expected RankgistWeb.NavComponents to define such a function or for it to be imported, but none are available)
│
45 │ href={~p"/track-competitors"}
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│
└─ (rankgist 0.1.0) lib/rankgist_web/components/nav_components.ex:45: RankgistWeb.NavComponents.main/1
error: undefined function sigil_p/2 (expected RankgistWeb.NavComponents to define such a function or for it to be imported, but none are available)
│
8 │ <.link href={~p"/"} class="flex items-center space-x-3 rtl:space-x-reverse">
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│
└─ (rankgist 0.1.0) lib/rankgist_web/components/nav_components.ex:8: RankgistWeb.NavComponents.main/1
== Compilation error in file lib/rankgist_web/components/nav_components.ex ==
** (CompileError) lib/rankgist_web/components/nav_components.ex: cannot compile module RankgistWeb.NavComponents (errors have been logged)
Compiling 1 file (.ex)
error: undefined function sigil_p/2 (expected RankgistWeb.NavComponents to define such a function or for it to be imported, but none are available)
│
55 │ href={~p"/users/log_out"}
│ ^^^^^^^^^^^^^^^^^^^^^^^^^
│
└─ (rankgist 0.1.0) lib/rankgist_web/components/nav_components.ex:55: RankgistWeb.NavComponents.main/1
error: undefined function sigil_p/2 (expected RankgistWeb.NavComponents to define such a function or for it to be imported, but none are available)
│
45 │ href={~p"/track-competitors"}
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│
└─ (rankgist 0.1.0) lib/rankgist_web/components/nav_components.ex:45: RankgistWeb.NavComponents.main/1
error: undefined function sigil_p/2 (expected RankgistWeb.NavComponents to define such a function or for it to be imported, but none are available)
│
8 │ <.link href={~p"/"} class="flex items-center space-x-3 rtl:space-x-reverse">
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
│
└─ (rankgist 0.1.0) lib/rankgist_web/components/nav_components.ex:8: RankgistWeb.NavComponents.main/1
== Compilation error in file lib/rankgist_web/components/nav_components.ex ==
** (CompileError) lib/rankgist_web/components/nav_components.ex: cannot compile module RankgistWeb.NavComponents (errors have been logged)
to fix the issue of sigil_p/2 being undefined:
defmodule LiveViewAppWeb.NavComponents do
use Phoenix.Component
use LiveViewAppWeb, :verified_routes
def main(assigns) do
~H"""...
use LiveViewAppWeb, :verified_routes
adding this fixed it.