错误:路由器未定义V0.7.0 Meteor 0.8.0

Error: Router is not defined V0.7.0 Meteor 0.8.0

本文关键字:Meteor V0 路由器 未定义 错误      更新时间:2023-09-26

我刚更新到最新的0.7.0,出现错误。

在更新之前,我使用"dev"分支Blaze,一切都很好。

我在/lib/router.js中有routes.js,所以它可以首先在客户端和服务器上加载。这是我在运行mrt:

时得到的错误
Your app is crashing. Here's the latest log.

/Users/pemmy/.meteor/tools/c2a0453c51/lib/node_modules/fibers/future.js:173
                        throw(ex);
                              ^
ReferenceError: Router is not defined
    at app/lib/routes.js:1:36
    at app/lib/routes.js:79:3
    at /Users/pemmy/projects/Meteor/projects/toonokio/.meteor/local/build/programs/server/boot.js:155:10
    at Array.forEach (native)
    at Function._.each._.forEach (/Users/pemmy/.meteor/tools/c2a0453c51/lib/node_modules/underscore/underscore.js:79:11)
    at /Users/pemmy/projects/Meteor/projects/toonokio/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.

这是我在router.js文件中的内容:

1. Router.configure({
2. //    layoutTemplate: 'basicLayout',
3.     notFoundTemplate: 'notFound',
4.     yieldTemplates: {
5. //        'header': { to: 'header' },
6. //        'footer': { to: 'footer' }
7.     }
8. });
79. Router.map(function () {
80.     this.route('home', {
81.         path :  '/',
82.         controller :  HomeController
83.     });
84. });

有什么建议我做错了,如何解决它?

谢谢,Praney

对我来说,我有这个错误,iron-router包从我的.meteor/packages文件中丢失了。替换它,并做了一个mrt install,它现在似乎工作。

尝试mrt install,仍然有问题。

mrt add iron-router帮我解决了

遵循以下答案可能会解决您的问题:

Meteor: App不支持0.9.1.1版本

meteor remove iron-router,然后meteor add iron:router,这解决了我的问题。

建议https://stackoverflow.com/a/25721887/565557