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

Ste*_*aff 3 updates meteor iron-router

我的应用程序一直在工作,直到我将其更新为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
iron:middleware-stack@1.0.11
underscore@1.0.6
Run Code Online (Sandbox Code Playgroud)

我真的很欣赏正确方向的一些指示.

Wil*_*ier 6

如果可以更改您的路由器并切换到,我会强烈推荐您FlowRouter.这是目前官方的Meteor路由器,如下所述:流星指南

试试这个:meteor update iron:middleware-stack.

您的问题似乎与此问题有关,并且已在1.1.0版本中修复.