gpt4 book ai didi

meteor - 使用铁时出错 :router with Meteor 0. 9.3.1

转载 作者:行者123 更新时间:2023-12-02 09:30:06 24 4
gpt4 key购买 nike

我正在尝试 Meteor 和 Iron:router。我 git 克隆了 https://github.com/EventedMind/iron-router.git 中的示例。然后我将 CD 编辑到样本/基本,并运行 meteor 更新和 meteor 。我的 meteor 版本是0.9.3.1

当我导航到该网站时,控制台中显示错误并且页面为空。错误如下:

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?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1853:25)
at http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1795:16
at Object.Blaze._withCurrentView (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:2029:12)
at viewAutorun (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1794:18)
at Tracker.Computation._compute (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:288:36)
at new Tracker.Computation (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:206:10)
at Object.Tracker.autorun (http://localhost:3000/packages/tracker.js?192a05cc46b867dadbe8bf90dd961f6f8fd1574f:476:11)
at Blaze.View.autorun (http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1793:19)
at http://localhost:3000/packages/blaze.js?7b7ff7ee2ccdccd85a1ad0d8dc9d96193e29e8b0:1847:10 debug.js:41

有人可以告诉我我做错了什么吗?

提前致谢。

最佳答案

您遇到此问题的原因是 iron-router@1.0.0-pre-x(例如 1.0 的 Beta)与当前使用的 0.9.x 版本之间存在差异铁路由器。

为模板 route 定义 http://localhost:3000/route 路由的旧表示法如下:

Router.route("route", { path : '/' });

但是在新版本中,目前在 github 上的 devel 上(我认为示例基于如下):

Router.route("/", function() {
this.render("route");
});

问题是使用底部的符号会导致错误无法找到名为“/”的模板,因为Route.route的第一个参数现在是路径而不是模板。

解决这个问题的方法是使用 Iron Router 的预发布版本(版本字符串可以在 github 上的 package.js 文件中找到):

meteor remove iron:router
meteor add iron:router@1.0.0-pre3

或者通过查看与 github 上的发行版捆绑在一起的示例来使用旧的符号,而不是像这样的 devel 分支: https://github.com/EventedMind/iron-router/tree/v0.9.2-rc0

关于meteor - 使用铁时出错 :router with Meteor 0. 9.3.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26239413/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com