Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : There is no route for the path: / #608

Open
ManojBitx opened this issue Apr 25, 2016 · 45 comments
Open

Error : There is no route for the path: / #608

ManojBitx opened this issue Apr 25, 2016 · 45 comments

Comments

@ManojBitx
Copy link

I have updated Meteor to Meteor 1.3.2.4. and facing the issue.
Error : There is no route for the path: /
I tried the both in both environment "meteor" and "meteor run --production" the same error will displayed in console.

I have installed the following packages.
accounts-oauth 1.1.12 Common code for OAuth-based login services
accounts-password 1.1.8 Password support for accounts
autopublish 1.0.7 (For prototyping only) Publish the entire database to all clients
blaze-html-templates 1.0.4 Compile HTML templates into reactive UI with Meteor Blaze
cfs:gridfs 0.0.33 GridFS storage adapter for CollectionFS
cfs:standard-packages 0.5.9 Filesystem for Meteor, collectionFS
ecmascript 0.4.3 Compiler plugin that supports ES2015+ in all .js files
email 1.0.12 Send email messages
es5-shim 4.5.10 Shims and polyfills to improve ECMAScript 5 support
flowkey:bootstrap-tour 1.1.0 A Meteor.js / Blaze integration for bootstrap-tour
insecure 1.0.7 (For prototyping only) Allow all database writes from the client
jquery 1.11.8 Manipulate the DOM using CSS selectors
kadira:blaze-layout 2.3.0 Layout Manager for Blaze (works well with FlowRouter)
kadira:flow-router 2.12.1 Carefully Designed Client Side Router for Meteor
meteor-base 1.0.4 Packages that every Meteor app needs
mobile-experience 1.0.4 Packages for a great mobile user experience
mongo 1.1.7 Adaptor for using MongoDB and Minimongo over DDP
pauli:accounts-linkedin 1.3.1 Accounts service for LinkedIn accounts
service-configuration 1.0.9 Manage the configuration for third-party services
session 1.1.5 Session variable
standard-minifier-css 1.0.6 Standard css minifier used with Meteor apps by default.
standard-minifier-js 1.0.6 Standard javascript minifiers used with Meteor apps by default.
themeteorchef:jquery-validation 1.14.0 jQuery Validation by jzaefferer, repackaged for Meteor.
tomi:upload-jquery 2.4.0 Client template for uploads using "jquery-file-upload" from blueimp
tomi:upload-server 1.3.4 Upload server for Meteor. Allows to save and serve files from arbitrary directory
tracker 1.0.13 Dependency tracker to allow reactive callbacks
u2622:persistent-session 0.4.4 Persistently store Session data on the client
zimme:active-route 2.3.2 Active route helpers

My routing.js is
exposed = FlowRouter.group();

exposed.route('/', {
triggersEnter: function () {
if (Meteor.loggingIn() && typeof Meteor.userId() !== 'undefined') {
FlowRouter.go("/dashboard");
}
},
action: function () {
BlazeLayout.render("mainTemplate", {content: "homePage"});
}
});

exposed.route('/login', {
triggersEnter: function () {
if (Meteor.userId() !== null) {
FlowRouter.go("/dashboard");
}
},
action: function (params) {
BlazeLayout.render("mainTemplate", {content: "login"});
}
});

@vmusulainen
Copy link

Yes. I have got same error.

@ManojBitx
Copy link
Author

@vmusulainen
I moved my routing.js to "lib/routing.js"
Now it working fine. Please try this.

@vmusulainen
Copy link

vmusulainen commented Apr 27, 2016

Yes, I agree all work fine if the route for "/" is set in a file and this file can be found.
But I faced with this error just after adding flow-iron package to my app. I have no any import "flow-roter" directive in any files yet.
Such behavior seems strange for me.

@ManojBitx
Copy link
Author

You can only use one routing package in a application. It always conflicts. Try removing Iron Router.

@vmusulainen
Copy link

No-no, I haven't any router in the app before.

when meteor starts the next code is executed

meteor://💻app/packages/kadira_flow-router/client/_init.js

// Initialize FlowRouter
Meteor.startup(function () {
  if(!FlowRouter._askedToWait) {
    FlowRouter.initialize();
  }
});

@ManojBitx
Copy link
Author

Can you show me installed packages list.

@vmusulainen
Copy link

Steps for reproducing

  1. meteor create flow-router-issue

  2. cd flow-router-issue

  3. meteor add kadira:flow-router

  4. meteor run

open a brower on http://localhost:3000 and you will get the next exception in console

router.js:347 There is no route for the path: /
Router._notfoundRoute           @ router.js:347
(anonymous function)            @ router.js:535
(anonymous function)            @ index.js:474
nextEnter                       @ index.js:306
page.dispatch                   @ index.js:312
page.replace                    @ index.js:275
self._page.(anonymous function) @ router.js:382
page.start                  @ index.js:168
page                        @ index.js:102
Router.initialize               @ router.js:391
(anonymous function)            @ _init.js:9
maybeReady                  @ startup_client.js:26
loadingCompleted                @ startup_client.js:38

Debug information

meteor --version
Meteor 1.3.2.4

meteor list

autopublish            1.0.7  (For prototyping only) Publish the entire database to all clients
blaze-html-templates   1.0.4  Compile HTML templates into reactive UI with Meteor Blaze
ecmascript             0.4.3  Compiler plugin that supports ES2015+ in all .js files
es5-shim               4.5.10  Shims and polyfills to improve ECMAScript 5 support
insecure               1.0.7  (For prototyping only) Allow all database writes from the client
jquery                 1.11.8  Manipulate the DOM using CSS selectors
kadira:flow-router     2.12.1  Carefully Designed Client Side Router for Meteor
meteor-base            1.0.4  Packages that every Meteor app needs
mobile-experience      1.0.4  Packages for a great mobile user experience
mongo                  1.1.7  Adaptor for using MongoDB and Minimongo over DDP
reactive-var           1.0.9  Reactive variable
standard-minifier-css  1.0.6  Standard css minifier used with Meteor apps by default.
standard-minifier-js   1.0.6  Standard javascript minifiers used with Meteor apps by default.
tracker                1.0.13  Dependency tracker to allow reactive callbacks

@pmoulos
Copy link

pmoulos commented Apr 27, 2016

I can confirm this... I 've spent the whole day trying to find out what is going on... In addition, if I move my routes.js to /lib, then I face problems when importing html templates which now have to be imported in routes.js as meteor cannot see them anymore in /imports/ui

@proehlen
Copy link

I can confirm this... I 've spent the whole day trying to find out what is going on... In addition, if I move my routes.js to /lib, then I face problems when importing html templates which now have to be imported in routes.js as meteor cannot see them anymore in /imports/ui

Had exactly the same issues. Only way I could solve it was going to a full meteor modules application structure per the meteor guide: http://guide.meteor.com/structure.html

Seems like overkill for the small demo app I was putting together to demonstrate a different problem but at least it works now.

@pmoulos
Copy link

pmoulos commented May 12, 2016

After lot of testing it seems that either Meteor 1.3 or the FlowRouter is extremely sensitive to errors that did not use to break apps. Most probably the former as now the order of imports is important. For example, I am using the Buttons plugin of DataTables. It could not find some default settings before the actual plugin was loaded next. I had to prefix with 00- to force loading order in /client/compatibility, then the error went away and the application starts...

@gstrobl
Copy link

gstrobl commented Jun 3, 2016

Does anyone found a solution for this problem?

@delki8
Copy link

delki8 commented Jun 20, 2016

+1

@daveyshindig
Copy link

daveyshindig commented Jun 22, 2016

Do I really have to refactor my entire application to fix this?

@blackode
Copy link

++ same is this problem solved?

@sturoid
Copy link

sturoid commented Jun 27, 2016

Same problem here. I am in the middle of moving my entire application to /imports and it started popping up about 80% of the way through. No matter what I do I can't get it to recognize the routes I have defined now.

@Nexus7
Copy link

Nexus7 commented Jun 29, 2016

I think I may have the same issue... still researching... but @vmusulainen your steps for reproducing may not be correct. After completing steps 1-4 you still have not created a router file. If you add a routes.js file in /lib with a path for '/' then you shouldn't see the error...

The above does make me think that the error is caused when FlowRouter cannot find the routes file, which is strange in my case as it exists in the /lib directory too...

@tyler-dunkel
Copy link

hi also having this issue. Any updates on this? Can i force it to load first by changing the file name or something?

@sturoid
Copy link

sturoid commented Jul 22, 2016

I fixed this finally. I removed any wait() and ready() callbacks from FlowRouter and handled any redirects inside my React "Application" component. Once I took that logic out of FlowRouter everything worked great.

@ghost
Copy link

ghost commented Jul 26, 2016

I also hit this problem now. I'm using Meteor 1.4 release.

My app was working until I git-cloned flow-router to myproj/packages/
and added it to my project. Suddenly FlowRouter could not find any routes.

It turns out it doesn't matter what router you import, if any type of router is part of your project it gets loaded.
So I had to remove the old (kadira:flow-router) and then the cloned one worked without the invisible conflict.


For anyone still experiencing this issue, you can try what Nexus7 suggested above, move myroutes.js to /lib but you don't have to move all your components. You can keep your components in /imports/client. I just tried it. Just wrap your import { foo } from '/imports/client/... stuff with if (Meteor.isClient) { and your set trigger stuff etc etc.

@noahsw
Copy link

noahsw commented Jul 26, 2016

@Nexus7 - can you post a forked meteor-todos with your change? I'm not following your fix 100%. Thx!

@deligence
Copy link

We are facing the same error. Anyone who has solved this issue?

@ghost
Copy link

ghost commented Aug 20, 2016

Hello I figured 2 bugs on my side that lead to this error message:

  • Put your routing logic in "lib" folder
    • as explained above, the jsx files that calls FlowRouter.route(...) must be in "lib" folder, else it doesn't work in the "root" or in the "client" folders
    • I tried the if (Meteor.isClient) { suggested above but it didn't work for me
  • meteor add ecmascript
    • I have an old application that has been upgraded from 1.2 to 1.3 and lately to 1.4.1 and for some reason I figured out that the JSX files were not run at all, I had to manually add the ecmascript package and then it started to work

@szimmers
Copy link

i found a timing issue with FlowRouter and AccountsTemplates, and waiting the FlowRouter.

i found this code in useraccounts_flow-routing:

// Initialization
if (FlowRouter && FlowRouter.initialize) {
  // In order for ensureSignIn triggers to work,
  // AccountsTemplates must be initialized before FlowRouter
  // (this is now true since useraccounts:core is being executed first...)
  var oldInitialize = FlowRouter.initialize;
  FlowRouter.initialize = function() {
    AccountsTemplates._init();
    oldInitialize.apply(this, arguments);
  };
}

that indicated to me there may be a race condition. whenever i had the failed route, i saw that AccountsTemplates was not yet initialized, so i changed my flow router wait code to include its initialize, and it seems to be working for me (this is at the top of my lib/routes.js):

if (Meteor.isClient) {
    FlowRouter.wait();
    Tracker.autorun(function() {
        if (Roles.subscription.ready() && AccountsTemplates._initialized && !FlowRouter._initialized) {
            FlowRouter.initialize()
        }
    });
}

... i put in this wait originally so i could easily check user roles (a la AccountsTemplates.ensureSignedIn) in some of the routes...

@szimmers
Copy link

per my comment above, it does look to fix 1 race condition. but i was still able to get into a scenario where there's a blank screen. unsure why: both the AT initialize and the FlowRouter initialize are still false, but the autorun seems to have stopped.

@szimmers
Copy link

if it helps anyone, i believe i've solved my 2nd race condition. it looks like AccountsTemplates._initialized could flip to true, but the autorun() wouldn't run. further, i attached an onStop() listener to the autorun() to demonstrate that it wasn't stopping.

it's a little ugly, but i used a timer to re-evaluate AccountsTemplates._initialized and invalidate the tracker once it goes true. so far, so good on getting rid of all of my blank screens.

if (Meteor.isClient) {
    FlowRouter.wait();

    var self = this;
    self.getATReady = () => AccountsTemplates._initialized;

    var timer = Meteor.setInterval(function() {
        if (self.getATReady()) {
            tracker.invalidate();
            clearInterval(timer);
        }
    }, 500);

    var tracker = Tracker.autorun(function() {
        if (!FlowRouter._initialized && Roles.subscription.ready() && self.getATReady()) {
            clearInterval(timer);
            FlowRouter.initialize()
        }
    });
}

@grinono
Copy link

grinono commented Sep 30, 2016

i'm having the exact same issue when i try to deploy.
running:

  • meteor 1.4.1
  • deployment with mup
  • Webapp build with React

currently testing the bug with

meteor run --production --settings settings-production.json

Try to solve it with;

  1. change the routes.js file location to /import/clients/routes.js
  2. change between mup/mupx and new mup deployment..
  3. change to flowrouter ServerSideRendering
  4. check for any Ready()
  5. tried @szimmers code in routing.js before FlowRouter.route()

Maybe changing to react router would do the trick.. but thats quite some migration effort.
If anyone found a solution for the "There is no route for the path: /" in production bundling. That would be great.

@cesarve77
Copy link

Any updates?

@karldanninger
Copy link

Yep, same here! 💅

@grinono
Copy link

grinono commented Oct 12, 2016

I cant help. I moved the project to react router. Much lager community to solve these issues.

@FrancisBou
Copy link

In my case the /import/client/startup/routes.js does not even run before Flowrouter so of course it has no routes.. I too wait for subscriptions from roles. Cloned flow-router in packages as well.

@arrygoo
Copy link

arrygoo commented Oct 24, 2016

Having issues here as well.

@jonarnaldo
Copy link

same here. any progress on this issue?

@cesarve77
Copy link

I my case i follow the answer of @szimmers, it's works while we got a official and better solution.

@newdayrising
Copy link

newdayrising commented Dec 3, 2016

I faced this issue when I tried to use Bootstrap 4 by placing it in a /main/client/lib/bootstrap/ folder (I attempted a million different methods for importing Bootstrap, no matter what I did it always loaded AFTER my custom css file - hence the lib folder). Bootstrap 4 gave an error in the console (described here: twbs/bootstrap#18732) - "Bootstrap tooltips require Tether."

I downgraded Bootstrap to the latest v3 which doesn't require Tether and the Flow Router issue was resolved.

This is congruent with the issue as described by @pmoulos :

After lot of testing it seems that either Meteor 1.3 or the FlowRouter is extremely sensitive to errors that did not use to break apps.

@AllanPinheiroDeLima
Copy link

AllanPinheiroDeLima commented Jan 31, 2017

I had the same problem once, what I did is delete all installed packages from package.json (not the ones who came with Meteor itself), then install one by one, first flow-router, then kadira blaze layout and tested with the two of then. Turns out it was a problem in the initialization of the plugin. It's a guess, but I think that I faced the problem because or I did'nt stopped the server before initialize flow router in first time or it was a package helper to flow router that was throwing an error.

So:

  • Uninstall all packages
  • Add in your terminal, not the package.json, kadira flow router and kadira: blaze-layout
  • Test with Google's of Firefox's console open

PS; sorry for this bad english

@benkissi
Copy link

benkissi commented Mar 18, 2017

A newbie here. Moving my routes.js to /lib worked for me, but you will have to wrap your code with if(Meteor.isClient){} for your imports to work.

@joaocarloscabral
Copy link

joaocarloscabral commented Sep 19, 2018

Removing meteor field (and modules) from package.json solved here.

@parlin
Copy link

parlin commented Oct 5, 2018

Removing meteor field (and modules) from package.json solved here.

This worked for me - Thanks @joaocarloscabral !

@dmattbergstrom
Copy link

dmattbergstrom commented Oct 24, 2018

Hi!

I didn't find the solution for this problem by anything here, but after 8 hours of hacking, i solved it.

  1. Some packages didn't work in production for me, in Meteor 1.8. Check all your non-core packages and try to remove them one by one and see if that fixes the issue.

I removed the following problematic packages:
aldeed:autoform
gwendall:auth-client-callbacks
dsyko-jquery-ui-touch

  1. Useraccounts was not included on both server and client. The page using that package was included in my routes.js file, and therefore mucked up all my routes, resulting in this nasty bug.

My tip for anyone who needs to figure out their own way of solving this bug:

  1. Start commenting out packages in .meteor/packages.json while running your app in the terminal with the production tag activated. That means, run your app with the following command, while removing possibly outdated packages (usually non-standard ones)

"meteor run --production"

  1. Keep the app running in production mode. Start commenting out routes in your routes.js file, and see if you can find the route/page that is mucking up all routes and causing this error.

Good luck!
/ Devmattb

@MastaBaba
Copy link

MastaBaba commented Nov 2, 2018

I'm getting this problem on Meteor 1.8, in the most basic setup:

  1. I create a new app with meteor create test.
  2. I add flow router meteor add kadira:flow-router.
  3. I add a routes.js with the following code:
FlowRouter.route('/', {
  name: 'home',
  action(params, queryParams) {
    console.log("Looking?");
  }
});

I start my app with meteor and get this when visiting my app:

There is no route for the path: /

I tried placing routes.js in /client and in /imports/startup/client/. Both result in the same error message.

Am I missing something obvious, or is this a meteor bug?

(I'm running other apps at 1.8, using flow-router, that were upgraded from 1.7x, without a problem.)

Edit:

If I put my routes (what was in routes.js) in main.js, flow-router works.

@chbrandt
Copy link

chbrandt commented Jun 6, 2019

For those fast-forwarding to the end looking for a solution: the solution given by @joaocarloscabral (#608 (comment)) worked like a charm.

As a side note, in my case the issue was happening during development (with meteor run).

Took off the meteor block from package.json:

{
  "name": "app",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "test": "meteor test --once --driver-package meteortesting:mocha",
    "test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
    "visualize": "meteor --production --extra-packages bundle-visualizer"
  },
  "dependencies": {
    "@babel/runtime": "^7.4.5",
     "meteor-node-stubs": "^0.4.1"
-  },
-  "meteor": {
-    "mainModule": {
-      "client": "client/main.js",
-      "server": "server/main.js"
-    },
-    "testModule": "tests/main.js"
   }
}

, restarted meteor run and things look good so far.

@quandarealest
Copy link

Removing meteor field (and modules) from package.json solved here.

Can't believe it works lol

@rafaeljcadena
Copy link

rafaeljcadena commented Feb 16, 2020

I'm getting this problem on Meteor 1.8, in the most basic setup:

  1. I create a new app with meteor create test.
  2. I add flow router meteor add kadira:flow-router.
  3. I add a routes.js with the following code:
FlowRouter.route('/', {
  name: 'home',
  action(params, queryParams) {
    console.log("Looking?");
  }
});

I start my app with meteor and get this when visiting my app:

There is no route for the path: /

I tried placing routes.js in /client and in /imports/startup/client/. Both result in the same error message.

Am I missing something obvious, or is this a meteor bug?

(I'm running other apps at 1.8, using flow-router, that were upgraded from 1.7x, without a problem.)

Edit:

If I put my routes (what was in routes.js) in main.js, flow-router works.

Try just import your routes file on main/client.js
import ./routes.js

You don't need to remove that:
"meteor": { "mainModule": { "client": "client/main.js", "server": "server/main.js" }, "testModule": "tests/main.js" }

from the package.json

@MastaBaba
Copy link

Thanks @rafaeljcadena

I don't have a /main/ folder. Should I create one in the root of my project?

@rafaeljcadena
Copy link

Thanks @rafaeljcadena

I don't have a /main/ folder. Should I create one in the root of my project?

Ops, my mistake. I should say:
Try just import your routes file on client/main.js
Like this:

import React from 'react';
import { Meteor } from 'meteor/meteor';
import { render } from 'react-dom';
import App from '/imports/ui/App'
import './routes.js'

Meteor.startup(() => {
render(<App />, document.getElementById('react-target'));
});

It's created by default on Meteor(v1.8). I'm using it with integrated with React.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests