小编Ste*_*aff的帖子

更新到Meteor 1.3后出错 - 名称为"onBeforeAction"的处理程序已存在

我的应用程序一直在工作,直到我将其更新为Meteor 1.3.现在我收到这个错误:

Exception in callback of async function: Error: Handler with name 'onBeforeAction' already exists.
at MiddlewareStack._create (http://localhost:3000/packages/iron_middleware-stack.js?hash=8a2aa73e86a32698fb9f60cea452e0ecb2e72b7f:190:13)
at MiddlewareStack.push (http://localhost:3000/packages/iron_middleware-stack.js?hash=8a2aa73e86a32698fb9f60cea452e0ecb2e72b7f:206:22)
at http://localhost:3000/packages/iron_middleware-stack.js?hash=8a2aa73e86a32698fb9f60cea452e0ecb2e72b7f:224:12
at Array.forEach (native)
at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?hash=8de51f9d86e95ae2ffee15a8db324a1decccba3e:139:11)
at MiddlewareStack.append (http://localhost:3000/packages/iron_middleware-stack.js?hash=8a2aa73e86a32698fb9f60cea452e0ecb2e72b7f:220:5)
at http://localhost:3000/packages/iron_middleware-stack.js?hash=8a2aa73e86a32698fb9f60cea452e0ecb2e72b7f:226:19
at Array.forEach (native)
at Function._.each._.forEach (http://localhost:3000/packages/underscore.js?hash=8de51f9d86e95ae2ffee15a8db324a1decccba3e:139:11)
at MiddlewareStack.append (http://localhost:3000/packages/iron_middleware-stack.js?hash=8a2aa73e86a32698fb9f60cea452e0ecb2e72b7f:220:5)
Run Code Online (Sandbox Code Playgroud)

我使用的唯一地方onBeforeAction是我的铁路由器路由控制器.它们都在同一个router.js文件中.

我定义了几个路由控制器,首先ApplicationController是扩展RouteController,然后是各种扩展的控制器ApplicationController.

ApplicationController = RouteController.extend({
  onBeforeAction: function() {
    //some code
    this.next();
  }
});

SomeController = ApplicationController.extend({
  onBeforeAction: function() {
    //some code
    this.next();
  }
});
Run Code Online (Sandbox Code Playgroud)

从错误消息我无法找出错误或在哪里寻找问题.

错误消息中提到的包的版本是:

iron:router@1.0.12 …
Run Code Online (Sandbox Code Playgroud)

updates meteor iron-router

3
推荐指数
1
解决办法
774
查看次数

标签 统计

iron-router ×1

meteor ×1

updates ×1