Meteor 0.8.0更新抛出“非功能”错误

时间:2014-03-28 04:59:54

标签: javascript meteor

在Meteor更新到0.8.0后,我遇到了铁路由器的一些问题,但我能够通过添加blade-layout包并更新iron-router来解决这些问题......

但是,现在我在浏览器控制台中收到以下错误(正常控制台不会丢失任何错误,只是告诉我应用程序在localhost:3000运行)。

当我尝试访问主页时,这是我在浏览器控制台中遇到的错误。这只是在我更新到Meteor 0.8.0之后才开始发生

Exception in defer callback: Error: Can't call non-function: [object Object]
    at Spacebars.call (http://localhost:3000/packages/spacebars.js?5d478ab1c940b6f5a88f78b8adc81a47f022da77:176:13)
    at Spacebars.mustacheImpl (http://localhost:3000/packages/spacebars.js?5d478ab1c940b6f5a88f78b8adc81a47f022da77:110:25)
    at Object.Spacebars.mustache (http://localhost:3000/packages/spacebars.js?5d478ab1c940b6f5a88f78b8adc81a47f022da77:114:39)
    at Template.__define__.HTML.DIV.class (http://localhost:3000/client/html/template.page_layout.js?b9f71b600d93464d684baf69d25d5f1c78c77785:6:22)
    at http://localhost:3000/packages/ui.js?b523ef986d3d39671bcb40319d0df8982acacfe8:2299:21
    at callWithNoYieldsAllowed (http://localhost:3000/packages/deps.js?7afb832ce6e6c89421fa70dc066201f16f9b9105:74:5)
    at _.extend._compute (http://localhost:3000/packages/deps.js?7afb832ce6e6c89421fa70dc066201f16f9b9105:212:7)
    at new Deps.Computation (http://localhost:3000/packages/deps.js?7afb832ce6e6c89421fa70dc066201f16f9b9105:144:10)
    at Object._.extend.autorun (http://localhost:3000/packages/deps.js?7afb832ce6e6c89421fa70dc066201f16f9b9105:361:13)
    at materialize (http://localhost:3000/packages/ui.js?b523ef986d3d39671bcb40319d0df8982acacfe8:2298:29) debug.js:41

如果有其他人遇到此错误,请通过可能的解决方案让我知道这意味着什么。

我很感激帮助。

2 个答案:

答案 0 :(得分:10)

你有一条线说错误在哪里

 at Template.__define__.HTML.DIV.class (http://localhost:3000/client/html/template.page_layout.js?b9f71b600d93464d684baf69d25d5f1c78c77785:6:22)

您应该使用blaze-layout并更改布局模板中的yield标签

旧的方式 {{yield}}或{{yield' footer'}}

一种新的方式 {{> yield}} {{> yield region =" footer"}}

https://github.com/EventedMind/blaze-layout

答案 1 :(得分:1)

替代原因

模板

<template name="answer">
        <li class="answer-title">
            {{answer .. this}}
        </li>   
</template>

answer不是帮助 function 时,会抛出错误Can't call non-function,因为此语法仅用于调用helpers并传递它们parameters。 IE浏览器。答案是:

Templates.answer.helpers({
   answer: function (parentCtx, self) { return self.batman ^ !parentCtx; }
});