Meteor 铁路由器:错误:无法';找不到名为“的模板”/&引用;或&引用;。你确定你定义了它吗?

Meteor 铁路由器:错误:无法';找不到名为“的模板”/&引用;或&引用;。你确定你定义了它吗?,meteor,iron-router,meteor-0.9.4,Meteor,Iron Router,Meteor 0.9.4,我无法设置简单的熨斗:路由器示例:(,) home.html: <template name="Home"> <h1>Welcome</h1> home </template> Router.route('/', function () { this.render('Home'); // Also tried 'home' }); 正在启动服务器: meteor 然后我得到(客户端): 我做错了什么 注意:如果我克隆(basic.

我无法设置简单的熨斗:路由器示例:(,)

home.html

<template name="Home">
  <h1>Welcome</h1>
  home
</template>
Router.route('/', function () {
  this.render('Home'); // Also tried 'home'
});
正在启动服务器:

meteor
然后我得到(客户端):

我做错了什么

注意:如果我克隆(basic.html和basic.js),我会得到完全相同的错误

此外:

流星版 流星0.9.41.0这是0.9.4?
目前,iron:router有两个版本

  • 铁:router@0.9.4
    是您键入
    meteor add iron:router
    时默认添加的版本,此版本是一年多前出现的
    iron:router
    的“遗留”分支中的最新版本,它可能是每个人都在使用的版本,尽管他们肯定应该更新到
  • 铁:router@1.0.0-从2014年10月20日起,preX
    X=4
    完全重写了程序包,旨在向后兼容,但引入了一个新的、更好的、完善的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
语法:


有时指南与预发布版本并不完全一致,如果您想了解最新信息,请查看github问题。

您使用的iron router版本不正确,请将其删除并添加
iron:router@1.0.0-改为pre4
。@saimemount非常感谢,这就是问题所在。当你使用与meteor当前版本不兼容的软件包时,这一点应该更加明显。实际上,iron router并没有明确说明其示例是按照1.0.0预发行版设计的,而不是iron:router@0.9.4.@saimeunt回答这个问题,我也遇到了同样的问题,需要向您进行投票。添加了关于这些
iron:router
版本控制问题的澄清。非常感谢:D,您让我度过了美好的一天:我们也遇到了同样的问题,但是在
iron:router@1.0.12
,而且只在手机上,有什么想法吗?
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)
    ...
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 ?