Routes.user_path/2 is undefined (module Routes is not available or is yet to be defined)

I’m going through the Phoenix Framework 1.4 and I get this error in one of the templates, /user_html/user.html.heex. Please assist.

Hi @Rauulll welcome. In order to help we need to see your code. Also please provide the version of phoenix you are using. Can you copy and paste the output of mix deps|grep phoenix ?

@benwilson512 Thank you for the quick respose. But I have already solved the issue.

  def router do
    quote do
      use Phoenix.Router, helpers: true

      # Import common connection and controller functions to use in pipelines
      import Plug.Conn
      import Phoenix.Controller
      import Phoenix.LiveView.Router
    end
  end

I just need to put :true on the rumbl_web.ex and import necessary modules.

But on another note. How do I stop phoenix from using the default layouts? like under /rumbl_web/component/layouts/app.html.heex

Based on what you’ve written you’re using the Phoenix 1.4 book but you’re using a project generated with like Phoenix 1.6 or 1.7. This is likely going to result in a lot of different issues because while the Phoenix code is backwards compatible the generators create pretty different projects these days ever since LiveView was introduced.

I would strongly suggest using a project generated with the versions specified in the book code.

1 Like

Okay thank you.