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 on npm start #38

Closed
tzarger opened this issue Feb 22, 2016 · 11 comments
Closed

Error on npm start #38

tzarger opened this issue Feb 22, 2016 · 11 comments

Comments

@tzarger
Copy link

tzarger commented Feb 22, 2016

Hello, with that latest bits with react-router-redux, I do see an error that is repeated in the console. The app still seems to run though, so not sure what is happening here:

Warning: Failed propType: Required prop router was not specified in RouterContext.
Warning: Failed propType: Required prop location was not specified in RouterContext.
Warning: Failed propType: Required prop routes was not specified in RouterContext.
Warning: Failed propType: Required prop params was not specified in RouterContext.
Warning: Failed propType: Required prop components was not specified in RouterContext.
Warning: [react-router] <RouterContext> expects a router rather than a history
Unhandled rejection TypeError: Cannot read property 'listenBeforeLeavingRoute' of undefined
at [object Object].getChildContext (/Users/Troy/Documents/Projects/3ree-master/node_modules/react-router/lib/RouterContext.js:75:35)
at [object Object].ReactCompositeComponentMixin._processChildContext (/Users/Troy/Documents/Projects/3ree-master/node_modules/react/lib/ReactCompositeComponent.js:326:53)
at [object Object].ReactCompositeComponentMixin.mountComponent (/Users/Troy/Documents/Projects/3ree-master/node_modules/react/lib/ReactCompositeComponent.js:225:100)
at [object Object].wrapper as mountComponent
at Object.ReactReconciler.mountComponent (/Users/Troy/Documents/Projects/3ree-master/node_modules/react/lib/ReactReconciler.js:37:35)
at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (/Users/Troy/Documents/Projects/3ree-master/node_modules/react/lib/ReactMultiChild.js:241:44)
at ReactDOMComponent.Mixin._createContentMarkup (/Users/Troy/Documents/Projects/3ree-master/node_modules/react/lib/ReactDOMComponent.js:591:32)
at ReactDOMComponent.Mixin.mountComponent (/Users/Troy/Documents/Projects/3ree-master/node_modules/react/lib/ReactDOMComponent.js:479:29)
at Object.ReactReconciler.mountComponent (/Users/Troy/Documents/Projects/3ree-master/node_modules/react/lib/ReactReconciler.js:37:35)
at [object Object].ReactCompositeComponentMixin.mountComponent (/Users/Troy/Documents/Projects/3ree-master/node_modules/react/lib/ReactCompositeComponent.js:225:34)
at [object Object].wrapper as mountComponent
at /Users/Troy/Documents/Projects/3ree-master/node_modules/react/lib/ReactServerRendering.js:42:38
at ReactServerRenderingTransaction.Mixin.perform (/Users/Troy/Documents/Projects/3ree-master/node_modules/react/lib/Transaction.js:136:20)
at Object.renderToString (/Users/Troy/Documents/Projects/3ree-master/node_modules/react/lib/ReactServerRendering.js:40:24)
at app.js:38:35
at /Users/Troy/Documents/Projects/3ree-master/node_modules/react-router/lib/match.js:65:5
From previous event:
at handleRender (app.js:16:4)
at Layer.handle as handle_request
at next (/Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/route.js:112:3)
at Layer.handle as handle_request
at /Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/index.js:277:22
at param (/Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/index.js:349:14)
at param (/Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/index.js:365:14)
at Function.process_params (/Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/index.js:410:3)
at next (/Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/index.js:271:10)
at jsonParser (/Users/Troy/Documents/Projects/3ree-master/node_modules/body-parser/lib/types/json.js:100:40)
at Layer.handle as handle_request
at trim_prefix (/Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/index.js:312:13)
at /Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/index.js:280:7
at Function.process_params (/Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/index.js:330:12)
at next (/Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/index.js:271:10)
at urlencodedParser (/Users/Troy/Documents/Projects/3ree-master/node_modules/body-parser/lib/types/urlencoded.js:88:40)
at Layer.handle as handle_request
at trim_prefix (/Users/Troy/Documents/Projects/3ree-master/node_modules/express/lib/router/index.js:312:13)

@tzarger
Copy link
Author

tzarger commented Feb 22, 2016

@GordyD If I removed {devTools} in app.js or rather set it to null ... the error goes away. Is this normal behavior on initial loading, etc.?

@robotate
Copy link

I get this error when i make requests to port 3000, but not 3001. The docs say to use :3001 for the dev server.

@GordyD
Copy link
Owner

GordyD commented Feb 22, 2016

Can you log the the req.url that this error was triggered on? This should help track what the issue is.

@tzarger
Copy link
Author

tzarger commented Feb 22, 2016

@GordyD --- > @robotate is correct, I have localhost:3000 in cache, so that it before I could hit :3001 ... and if I do port 3001, no error, but port :3000 the app sort of shows and just throws that error in the console. So with that, I will close this as it was not an issue with the code itself; user, or cache, error.

@tzarger tzarger closed this as completed Feb 22, 2016
@endigo
Copy link

endigo commented Feb 23, 2016

How to fix it?
I think it's not cache error. RouterContext should have history prop. But history prop is just
{ }

@tzarger
Copy link
Author

tzarger commented Feb 23, 2016

@endigo What I meant by cache, you know how when typing a URL I typed localhost:3 and hit tab and :3000 was in the URL cache so I saw the error. if I explicitly type localhost:3001 I didn't see the error. Are you seeing the error even when only hitting localhost:3001?

@endigo
Copy link

endigo commented Feb 24, 2016

@tzarger No error occurs on port 3001. Only on port 3000. I was use firefox, chrome, chrome incognito mode, it's occurs same error

@snobear
Copy link
Contributor

snobear commented Feb 24, 2016

Yeah I get the same when hitting http://localhost:3001, and it seems benign. It seems to happen when first loading the site in the browser after an npm start. I cleared my cache in Chrome but it still happens. I'll try to nail it down and provide more info.

@GordyD
Copy link
Owner

GordyD commented Feb 24, 2016

Thanks for looking into this. If I get time to look over the weekend I'll try to investigate too.

@ryanyogan
Copy link

  match({ routes, location: req.url }, (error, redirectLocation, renderProps) => {
    if (error) {
      console.log('Error', error);
      res.status(500).send(error);
    } else if (redirectLocation) {
      res.redirect(302, redirectLocation.pathname + redirectLocation.search);
    } else if (renderProps) {
      const devTools = (isDev) ? <DevTools /> : null;
      const html = renderToString(
        <RouterContext {...renderProps} />
      );
      res.render('index', { isProd: (!isDev), html: html });
    } else {
      res.status(404).send('Not Found');
    }
  });

@GordyD It looks like it is just an issue of keeping up with react-router's fast moving changes. This is a bit more idiomatic.

@ReganHe
Copy link

ReganHe commented Jun 7, 2016

@ryanyogan is correct.the 'renderProp' is not always has value.when it doesn't, the error reappears.

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

7 participants