Search code examples
meteoriron-router

yield isnt rendering the template


I have only two files in my project.

1) runner.html

<template name="layout">
inside
{{> yield }}
</template>

<template name="test">
Home
</template>

2) runner.js

Router.configure({

layoutTemplate:'layout'
});

Router.map(function(){
this.route("test",{
path:'/',
template: 'test'
})
});

Now when i open the browser i only get

inside

and even if i remove the template , meteor doesnt throw error that it cant find the template.I have updated meteor to 1.2.0.1 recently. also there is an error in the console which i couldnt figure out as there is nothing there in the code.

the trace is

Exception in callback of async function: MiddlewareStack.prototype.concat@http://localhost:10001/packages/iron_middleware-stack.js?ff70621b6c5f6a406edc60600c4b76126dae21d6:303:7
RouteController.prototype._runRoute@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:542:11
Route.prototype.dispatch@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:856:10
Route/route@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:713:5
boundNext@http://localhost:10001/packages/iron_middleware-stack.js?ff70621b6c5f6a406edc60600c4b76126dae21d6:425:16
Meteor.bindEnvironment/<@http://localhost:10001/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:1007:17
dispatch@http://localhost:10001/packages/iron_middleware-stack.js?ff70621b6c5f6a406edc60600c4b76126dae21d6:449:3
RouteController.prototype.dispatch/</<@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:393:7
Tracker.Computation.prototype._compute@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:357:5
Tracker.Computation@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:245:5
Tracker.autorun@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:596:11
RouteController.prototype.dispatch/<@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:391:5
Tracker.nonreactive@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:623:12
RouteController.prototype.dispatch@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:390:3
Router.prototype.dispatch@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:1700:3
onLocationChange@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:1784:20
Tracker.Computation.prototype._compute@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:357:5
Tracker.Computation@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:245:5
Tracker.autorun@http://localhost:10001/packages/tracker.js?16c53d4f91467c6a41bbb860bf6c48f871710022:596:11
Router.prototype.start@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:1777:31
Router/</<@http://localhost:10001/packages/iron_router.js?dd5fa02859b6335661b94134bd9903be8eecf44d:980:9
.withValue@http://localhost:10001/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:979:17
withoutInvocation/<@http://localhost:10001/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:436:26
Meteor.bindEnvironment/<@http://localhost:10001/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:1007:17
onGlobalMessage@http://localhost:10001/packages/meteor.js?637cc835a2ee4a2302a010c9a4c97b906db5f41c:373:11
 meteor.js:888:11

NOTE : both files are in the project root and i have just installed iron:router nothing else.


Solution

  • Most likely the same problem I had and multiple other people had lately. It's caused by some version issues I am guessing since meteor is going through rapid change. The fix has been to do:

    meteor add ejson

    As seen here: How to use yield and Iron-router?