Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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...

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).

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

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.

like image 822
user1952811 Avatar asked Dec 19 '22 16:12

user1952811


2 Answers

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

the old way {{yield}} or {{yield 'footer'}}

a new way {{> yield}} {{> yield region="footer"}}

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

like image 193
timtch Avatar answered Dec 24 '22 01:12

timtch


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. Ie. When answers is:

Templates.answer.helpers({
   answer: function (parentCtx, self) { return self.batman ^ !parentCtx; }
});
like image 44
Matyas Avatar answered Dec 24 '22 03:12

Matyas