简体   繁体   English

流星0.8.0更新引发“非功能”错误

[英]Meteor 0.8.0 update throws out a “non function” error

After the Meteor update to 0.8.0 I had some issues with iron-router, but I was able to fix them by adding the blade-layout package and updating iron-router ... 在Meteor更新到0.8.0之后,我对Iron-Router遇到了一些问题,但是我可以通过添加blade-layout软件包并更新iron-router来解决它们。

However, now I get the following error in the browser console, (the normal console doesn't throw out any errors, just tells me app is running at localhost:3000). 但是,现在我在浏览器控制台中收到以下错误,(普通控制台不会抛出任何错误,只是告诉我应用程序正在本地主机上运行:3000)。

This is the error I get in the browser console when I try to visit the home page. 这是我尝试访问主页时在浏览器控制台中遇到的错误。 This only started happening after I updated to Meteor 0.8.0 我更新到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

If anyone else has experienced this error, please let me know what it means with a possible solution. 如果其他任何人都遇到此错误,请告诉我使用可能的解决方法意味着什么。

I appreciate the help. 感谢您的帮助。

you have a line there which says where is the error 您在那一行显示错误在哪里

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

You should use the blaze-layout and change the yield tags inside of a layout template 您应该使用blaze-layout并在布局模板中更改yield标签

the old way {{yield}} or {{yield 'footer'}} 旧的{{yield}}或{{yield'footer'}}

a new way {{> yield}} {{> yield region="footer"}} 一种新的方法{{> yield}} {{> yield region =“ footer”}}

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

Alternative cause 替代原因

Template 模板

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

When answer is not a helper function the error Can't call non-function is thrown, becaue this syntax is only for calling helpers and passing them parameters . 如果answer不是辅助function ,则会引发错误Can't call non-function ,因为此语法仅用于调用helpers parameters并将其parameters传递给。 Ie. 就是 When answers is: 当答案是:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM