未定义函数:MyApp.Addict.Controller.init/1

undefined function: MyApp.Addict.Controller.init/1

我正在使用 addict with Phoenix: 1.0.3,我已经按照 README 指南在我的应用程序中使用登录。调用登录时出现以下错误:

[error] #PID<0.2576.0> running MyApp.Endpoint terminated
Server: localhost:4000 (http)
Request: POST /login
** (exit) an exception was raised:
** (UndefinedFunctionError) undefined function: MyApp.Addict.Controller.init/1 (module MyApp.Addict.Controller is not available)
MyApp.Addict.Controller.init(:login)
(my_app) web/router.ex:1: anonymous fn/1 in MyApp.Router.match/4
(my_app) lib/phoenix/router.ex:255: MyApp.Router.dispatch/2
(my_app) web/router.ex:1: MyApp.Router.do_call/2
(my_app) lib/my_app/endpoint.ex:1: MyApp.Endpoint.phoenix_pipeline/1
(my_app) lib/plug/debugger.ex:90: MyApp.Endpoint."call (overridable 3)"/2
(my_app) lib/phoenix/endpoint/render_errors.ex:34: MyApp.Endpoint.call/2
(plug) lib/plug/adapters/cowboy/handler.ex:15: Plug.Adapters.Cowboy.Handler.upgrade/4
(cowboy) src/cowboy_protocol.erl:442: :cowboy_protocol.execute/4

这是由于我在 router.ex 中的以下错误:

  scope "/", MyApp do
    addict :routes
  end

这应该是:

  scope "/" do
    addict :routes
  end

在我的案例中,错误已通过 运行:

解决
$ mix deps.compile --force 

产生错误的控制器已经存在了一段时间,并且有一个控制器测试没有报告任何错误。