Reputation: 63
WINDOWS 7 64BIT
METEOR V 1.2.1
IRON:ROUTER V 1.0.11
I just started learning Meteor and I'm stuck trying to get iron router working properly, currently I have my router.js file in the client folder, which is working fine, but if I place it in the /lib folder the app crashes.
ReferenceError: router is not defined
at lib/router.js:1:1
Upvotes: 0
Views: 86
Reputation: 63
The fix that worked for me was to remove Iron Router, and the router.js file. Reinstall it, then create a new router.js file. Very possible that as Leonardy Kristianto suggested, the file was somehow corrupt. I've seen this problem several times on here, with no definitive answer, but it seems the overall consensus is to reinstall.
Make sure you have:
Upvotes: 0
Reputation: 104
Provided that you have successfully added the iron-router
package: from the error thrown by the console, it's possible that you mistyped Router
as router
.
An excerpt from iron-router repository:
// Create some routes in a client/server JavaScript file
Router.route('/', function () {
this.render('MyTemplate');
});
Upvotes: 1