The Myapp.Router.Helpers module is not loaded or not found.

Compilation error in Elixir / Phoenix application:

== Compilation error on file web/views/layout_view.ex ==
** (CompileError) web/views/layout_view.ex:2: module Myapp.Router.Helpers is not loaded and could not be found
    expanding macro: Myapp.Web.__using__/1
    web/views/layout_view.ex:2: Myapp.LayoutView (module)
    (elixir) expanding macro: Kernel.use/2
    web/views/layout_view.ex:2: Myapp.LayoutView (module)
    (elixir) lib/kernel/parallel_compiler.ex:117: anonymous fn/4 in Kernel.ParallelCompiler.spawn_compilers/1

My web.ex is standard, nothing new in it.

+6
source share
3 answers

I saw this if one of the inputs imports MyApp.Router.Helpersand is itself used in MyApp.Router. This creates a compiler deadlock — a plug is needed to compile the router, but a router (and an auxiliary module) is required to compile the plug-in.

You can fix this by using full calls for the router helpers rather than importing them, i.e.

alias MyApp.Router.Helpers, as: Routes
Routes.foo_path(conn, :create)
+15
source

, . , . , .

+8

I got the same error due to an error in Absinthe Schema, forgot the alias of some of the modules used. I found it with the help of the rmarscher board, commented on all the areas where MyAppWeb.Router.Helpers used and received real errors.

+4
source

Source: https://habr.com/ru/post/1660563/


All Articles