作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在设置一个简单的 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:router
有两个版本.
iron:router@0.9.4
是输入meteor add iron:router
时默认添加的那个,这个版本是iron:router
的“遗留”分支中的最新版本一年多前出现的,每个人可能仍在使用,尽管他们肯定应该更新到...iron:router@1.0.0-preX
与 X = 4
截至 2014 年 10 月 20 日,这是对包的完全重写,旨在向后兼容,但引入了一个新的、更好的和完善的 API。当 meteor 在今年晚些时候发布 1.0.0 时,这个版本可能会被设置为默认版本。问题是 iron:router
的 github 页面显示此特定分支 ( 1.0.0-pre4
) 以及人们认为可与 0.9.4
一起使用的示例.这意味着您很可能使用了错误版本的 iron router,使用 meteor remove iron:router
删除它和 meteor add iron:router@1.0.0-pre4
相反。
推荐阅读了解最新iron:router
语法:
http://eventedmind.github.io/iron-router/
有时该指南并不完全与预发布版本保持同步,如果您想了解最新信息,请查看 github issues。
关于meteor - Iron router : Error: Couldn't find a template named "/" or "". 你确定是你定义的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26450293/
我是一名优秀的程序员,十分优秀!