模块Myapp.Router.Helpers未加载,无法找到

Jio*_*Jio 6 elixir phoenix-framework

Elixir/Phoenix应用程序中的编译错误:

== 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
Run Code Online (Sandbox Code Playgroud)

我的web.ex是一个标准的,没有什么新东西.

mic*_*ala 15

如果其中一个插件导入MyApp.Router.Helpers,我已经看到了这种情况,并且同时在它MyApp.Router自身中使用.这会产生编译器死锁 - 为了编译路由器需要插件,但为了编译插件,需要路由器(和辅助模块).

你可以通过使用对路由器助手的完全限定的调用来解决这个问题,而不是导入它们,即

alias MyApp.Router.Helpers, as: Routes
Routes.foo_path(conn, :create)
Run Code Online (Sandbox Code Playgroud)


rma*_*her 8

当我的一个插件包含错误并且没有编译时,这也发生在我身上.通过注释掉我的路由器的内容并再次编译,我能够看到插件中的编译错误.修复它们并取消注释我的路由器的内容后,它能够正常编译.