Closed rmzlb closed 7 years ago
Same problem here. The console is displaying:
Error: There are multiple templates named 'Home'. Each template needs a unique name. templating-runtime.js:55:13 TypeError: Package['iron:router'] is undefined global-imports.js:9:1 ReferenceError: meteorInstall is not defined app.js:1:9
Here is my routing file, and the "home" template is defined only once (1 HTML file with definition + 1JS file with logic) ( I didn't find any way to upload it, the .js extension if refused ):
import { Meteor } from 'meteor/meteor';
import { Router, RouteController } from 'meteor/iron:router';
hasLikedEnoughMovies = function(user) {
return true;
}
/* Controleur standard qui fait les vérifications de base:
- redirection vers l'accueil si pas loggé
- redirection vers la proposition de film si moins de 10 films aimés
On peut se le permettre vu que ce sont les seules vérifications à faire, et qu'elles sont globales
sur toute l'application
*/
ApplicationController = RouteController.extend({
onBeforeAction: function() {
if(!this.ready() || Meteor.loggingIn()) {
this.next();
//this.render('loading');
}
else {
var user = Meteor.user();
// pas loggé
if(!user) {
//console.log("Redirection to login page...");
this.render('login', {message: "Loggez vous"});
}
// Pas liké assez de films
else if(!hasLikedEnoughMovies(user)) {
this.render('proposeMovie');
}
else {
this.next();
}
}
}
});
/*
Configuration globale du routeur : on définit le controlleur par défaut pour toute route
*/
Router.configure({
controller: 'ApplicationController',
notFoundTemplate: 'notFoundTemplate'
});
// Accueil
Router.route('/', {
name: 'home',
action: function() {
this.render('home');
}
});
// Login/rgister
Router.route('/login', {
name: 'login',
action: function() {
this.render('login');
}
});
// Proposition de film
Router.route('/proposeMovie', {
name: 'proposeMovie',
action: function() {
this.render('proposeMovie');
}
});
// Affichage "mes listes"
Router.route('/mylists', {
name: 'mylists',
action: function() {
this.render('mylists');
}
});
// Affichage d'une liste (dont films aimés? Peut-être une route à part)
Router.route('/list/:_id', {
name: 'showlist',
action: function() {
this.render('showlist');
}
});
I'm deeply sorry for the french comments, but the code should be really easy to understand. 😄
Latest release is broken. Rolling back via below solved the issue for me:
meteor add iron:router@=1.0.13
@myrtleTree33 This solution worked for me.
@rmzlb @Genroa @myrtleTree33 @csellis can you guys try again with 1.1.1 from atmosphere?
@myrtleTree33 thanks this worked for me on a new project ! thus the issue on 1.1.1 is still open what's the status ?
I have the same issue, and after trying with iron:router downgraded from 1.1.0 to 1.0.13
it solves !!
@byronrwth does 1.1.1 work for you?
Same issue. Fresh install through iron worker, and manually tried 1.0.13
, 1.1.1
, and 1.1.2
Solved (at least in my case)... it turned out to be some version conflicts with Autoform/Collections2/Select2. Forced updates across, and now it works. Clue was meteorInstall is not defined
error
@nodeGarden in the future it would be more useful not to refer to it as a "fresh install" if you have other non-default/non-standard packages installed... but thanks for following up your post with an answer!
seems like iron router claims to have no route definitions found when there's another JS error in some other script.
@marcelhadorn right, if that error prevents Router.route()
from being called but the app still builds then this page will show
@chrisbutler I think it would be helpful if that message would indicate that either it's because no route definitions are found or some javascript error might cause this message. Sure one could open the console and figure that, but if there's a feedback suggesting that there's something wrong with the routes, one obviously tries to find the problem where the feedback tells you to look at.
I ran into this issue when I accidentally published on the client. The error of routing through me for a bit until I rolled back each change (sadly I was also working on the router so it was quite confusing).
I agree with @marcelhadorn the error should be better described or at least contain some caveat that it might not be the router itself.
This worked for me with iron:router 1.1.2. Hope it helps. 😃 iron add templating iron remove static-html cd app meteor npm install bcrypt --save
i tried with iron:router 1.0.13 and 1.1.2 but still got the same error, but just on ios.
I don't know, but maybe its like @nodeGarden said, because of: "version conflicts with Autoform/Collections2" or other packages?
accounts-base@1.4.2 accounts-facebook@1.3.1 accounts-oauth@1.1.15 accounts-password@1.5.1 alanning:roles@1.2.16 aldeed:autoform@6.3.0 aldeed:collection2@3.0.0 aldeed:simple-schema@1.5.3 aldeed:template-extension@4.1.0 allow-deny@1.1.0 amplify@1.0.0 autoupdate@1.4.0 babel-compiler@7.0.5 babel-runtime@1.2.2 base64@1.0.11 binary-heap@1.0.10 blaze@2.3.2 blaze-html-templates@1.1.2 blaze-tools@1.0.10 boilerplate-generator@1.4.0 caching-compiler@1.1.11 caching-html-compiler@1.1.2 callback-hook@1.1.0 check@1.3.0 coffeescript@1.0.17 d3@1.0.0 ddp@1.4.0 ddp-client@2.3.1 ddp-common@1.4.0 ddp-rate-limiter@1.0.7 ddp-server@2.1.2 deps@1.0.12 derelinguo:progressbarjs@0.0.1 diff-sequence@1.1.0 disable-oplog@1.0.7 dynamic-import@0.3.0 ecmascript@0.10.5 ecmascript-runtime@0.5.0 ecmascript-runtime-client@0.6.2 ecmascript-runtime-server@0.5.0 ejson@1.1.0 email@1.2.3 es5-shim@4.7.3 facebook-oauth@1.4.0 fortawesome:fontawesome@4.7.0 fourseven:scss@4.5.4 geojson-utils@1.0.10 hot-code-push@1.0.4 html-tools@1.0.11 htmljs@1.0.11 http@1.4.0 id-map@1.1.0 iron:controller@1.0.12 iron:core@1.0.11 iron:dynamic-template@1.0.12 iron:layout@1.0.12 iron:location@1.0.11 iron:middleware-stack@1.1.0 iron:router@1.0.13 iron:url@1.1.0 jabbslad:basic-auth@0.2.2 jorisroling:circular-progress@1.0.0 jquery@1.11.11 launch-screen@1.1.1 livedata@1.0.18 localstorage@1.2.0 logging@1.1.19 lookback:logger@1.2.0 lukemadera:social-share@1.2.0 mdg:validation-error@0.5.1 meteor@1.8.3 meteor-base@1.3.0 meteorhacks:inject-initial@1.0.4 meteorhacks:picker@1.0.3 minifier-css@1.3.1 minifier-js@2.3.3 minimongo@1.4.3 mobile-experience@1.0.5 mobile-status-bar@1.0.14 modules@0.11.5 modules-runtime@0.9.2 momentjs:moment@2.10.6 mongo@1.4.4 mongo-dev-server@1.1.0 mongo-id@1.0.6 mongo-livedata@1.0.12 mrt:flash-messages@1.0.1 npm-bcrypt@0.9.3 npm-mongo@2.2.34 oauth@1.2.1 oauth2@1.2.0 observe-sequence@1.0.16 ordered-dict@1.1.0 patrickml:braintree@1.32.0 planefy:paypal-ipn-listener@1.0.1 promise@0.10.2 raix:eventemitter@0.1.3 raix:handlebar-helpers@0.2.5 random@1.1.0 rate-limit@1.0.9 reactive-dict@1.2.0 reactive-var@1.0.11 reload@1.2.0 retry@1.1.0 reywood:iron-router-ga@2.0.1 robertlowe:persistent-reactive-dict@0.1.2 routepolicy@1.0.12 server-render@0.3.0 service-configuration@1.0.11 session@1.1.7 sha@1.0.9 shell-server@0.3.1 shim-common@0.1.0 socket-stream-client@0.1.0 softwarerero:accounts-t9n@1.3.11 spacebars@1.0.15 spacebars-compiler@1.1.3 srp@1.0.10 standard-minifier-css@1.4.1 standard-minifier-js@2.3.2 templating@1.3.2 templating-compiler@1.3.3 templating-runtime@1.3.2 templating-tools@1.1.2 tmeasday:check-npm-versions@0.3.2 tracker@1.1.3 ui@1.0.13 underscore@1.0.10 url@1.2.0 useraccounts:core@1.14.2 useraccounts:unstyled@1.14.2 webapp@1.5.0 webapp-hashing@1.0.9
Also check to see if your packages are properly installed. This error can also occur, whenever Chrome throws out an error like this: 'Uncaught Error: Cannot find module 'xyz'. Simply using npm install xyz
fixes the router error, which is shown at the top of this page.
with the following setup it works now (at least in my case):
Meteor version METEOR@1.6.1.1
Meteor packages aldeed:collection2@3.0.0 aldeed:autoform@6.3.0
npm package: simpl-schema 1.4.2
"And then also extend SimpleSchema to allow the autoform option in your schemas"
import SimpleSchema from 'simpl-schema'; SimpleSchema.extendOptions(['autoform']);
like described here: https://github.com/aldeed/meteor-autoform#installation
Dear all,
First post on the topic, I tried everything. I am not able to get the router working, the server keep freezing on this page when iron-router is on :
Thanks in advance for your kind help.
Router.configure({ layoutTemplate: 'mainLayout', }); Router.route('/', { name: 'accueil' });
`
Mon site
Accueil
`