A compilation error in an 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 a standard one, nothing new in it.
I've seen this happening if one of the plugs imports MyApp.Router.Helpers
, and is used in the MyApp.Router
itself at the same time. This creates a compiler deadlock - in order to compile the router the plug is required, but in order to compile the plug, the router (and helper module) is required.
You can fix this by using fully qualified calls to the router helpers instead of importing them, i.e.
alias MyApp.Router.Helpers, as: Routes
Routes.foo_path(conn, :create)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With