【发布时间】:2014-10-20 06:09:54
【问题描述】:
我无法设置一个简单的 Iron:router 示例:(docs, sample app)
meteor create testapp
cd testapp
home.html:
<template name="Home">
<h1>Welcome</h1>
home
</template>
router.js:
Router.route('/', function () {
this.render('Home'); // Also tried 'home'
});
启动服务器:
meteor
然后我得到(客户端):
Exception from Tracker recompute function: Error: Couldn't find a template named "/" or "". Are you sure you defined it?
at null._render (http://localhost:3000/packages/iron_dynamic-template.js?32038885cb1dad7957291ffebfffcb7f8cd57d20:239:17)
at doRender (http://localhost:3000/packages/blaze.js?88aac5d3c26b7576ac55bb3afc5324f465757709:1853:25)
...
我做错了什么?
注意:如果我克隆 the example application(basic.html 和 basic.js),我会得到完全相同的错误。
meteor list
autopublish 1.0.1 Publish the entire database to all clients
insecure 1.0.1 Allow all database writes by default
iron:router 0.9.4 Routing specifically designed for Meteor
meteor-platform 1.1.2 Include a standard set of Meteor packages in your app
还有:
meteor --version
Meteor 0.9.4 <- Why all standard packages and meteor platform are > 1.0 and this is 0.9.4 ?
【问题讨论】:
-
您使用的是错误版本的 Iron 路由器,删除它并添加
iron:router@1.0.0-pre4代替。 -
@saimeunt 非常感谢,这就是问题所在。当您使用与当前版本的流星不兼容的包时,确实应该更明显。
-
它实际上是 Iron 路由器,并没有明显表明它的示例是使用 1.0.0 预发行版设计的,而不是 Iron:router@0.9.4。
-
@saimeunt 回答这个问题,我遇到了同样的问题,需要给你点赞。
-
添加了关于这些
iron:router版本控制问题的说明。
标签: meteor iron-router meteor-0.9.4