Module BpmServer.Router.Helpers is not loaded and could not be found

Any idea how to debug this one?

ubuntu@c79ed82f0073:/stefan/bpm_app/apps/bpm_server$ mix phoenix.routes
Compiling 9 files (.ex)

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


1 Like

Could be caused by a corrupted build (wipe _build to clean that out). Could be caused by a recursive use or require call. Could be a few other things.

If you can make a minimal testcase then I’d bet the cause would be obvious then, but I’d start by checking the above two. :slight_smile:


Alternatively you have a circular compilation dependency. This happens to people when they try to import route helpers inside a plug that they’re using in the router.

This reason that this is impossible is that the router must be compiled before the route helpers can exist. However, the router must have all its plugs compiled before it can exist. If you have a plug that imports the route helpers, you have a circle.

The solution is to make them remote calls, ie BpmServer.Router.Helpers.whatever_path


Thank you! This was the issue for me. It makes perfect sense in retrospect.