Ferenc
Compilation error verified path: (ArgumentError) paths must begin with /
I have installed it on Phoenix 1.8.1 (without authentication or other packages and got 2 problems).
I had to set up things manually the 2nd way because the mix routex.install command produced this error in terminal:
$ mix routex.install
** (Mix) The task “routex.install” could not be found
And the second issue is that when trying to sue the code in live view
then this part → <.link is showing this error:
** (FunctionClauseError) no function clause matching in anonymous fn/1 in Routex.Branching.build_case/6
The following arguments were given to anonymous fn/1 in Routex.Branching.build_case/6:
\# 1
{:->, \[newlines: 1\], \[\[0\], {{:., \[\], \[Phoenix.VerifiedRoutes, :sigil_p\]}, \[\], \[{:<<>>, \[line: 29\], \["/thermostat"\]}, \[\]\]}\]}
(routex 1.2.4) lib/routex/branching.ex:207: anonymous fn/1 in Routex.Branching.build_case/6
(elixir 1.17.3) lib/enum.ex:4796: Enum.uniq_list/3
(routex 1.2.4) lib/routex/branching.ex:207: Routex.Branching.build_case/6
expanding macro: Helloi18nWeb.Router.RoutexHelpers.sigil_p/2
lib/helloi18n_web/live/thermostat_live.ex:29: Helloi18nWeb.ThermostatLive.render/1
(phoenix_live_view 1.1.13) expanding macro: Phoenix.Component.sigil_H/2
lib/helloi18n_web/live/thermostat_live.ex:6: Helloi18nWeb.ThermostatLive.render/1
the router looks like this:
preprocess_using ExampleWeb.RoutexBackend do
scope “/”, Helloi18nWeb do
pipe_through :browser
get "/", PageController, :home
get "/products", PageController, :home
#
live "/thermostat", ThermostatLive
end
end
–
the lang switcher example:
works without any errors.
Marked As Solved
BartOtten
I’ve found the issue. The devil is in the details:
So far, all examples have used
/to delimit a regular expression. However, sigils support 8 different delimiters:~r/hello/ ~r|hello| ~r"hello" ~r'hello' ~r(hello) ~r[hello] ~r{hello} ~r<hello> https://hexdocs.pm/elixir/main/sigils.html
So both () and " are delimiters, but only the first one is used as such. As a result, the argument for the sigil is "/termostat" instead of /termostat. The former not starting with a / but a "
Fix: use either ( or “, not both
<.link navigate={~p“/thermostat”}>{gettext(“Thermostat”)}</.link>
or
<.link navigate={~p(/thermostat)}>{gettext(“Thermostat”)}</.link>
Also Liked
BartOtten
Sorry for the delay; some tasks popped up last few days. Hope to have a look at it later today.
BartOtten
Thanks for the confirmation. Package published to routex | Hex
BartOtten
Please remove the quotes and type them again. Have been bitten once or twice in life by not-exactly-the-correct-quotes.
Will return problem hunting at monday!
BartOtten
Not sure why, but there is unexpected metadata causing the clause to fail. Will publish a fix on Github in minutes.
BartOtten
This should fix it either way:
Could you try using this as dep?
{:routex, git: "https://github.com/BartOtten/routex"}








