Giter Site home page Giter Site logo

Error on npm start about 3ree HOT 11 CLOSED

gordyd avatar gordyd commented on May 2, 2024
Error on npm start

from 3ree.

Comments (11)

ryanyogan avatar ryanyogan commented on May 2, 2024 5
  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.

from 3ree.

tzarger avatar tzarger commented on May 2, 2024

@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.?

from 3ree.

robotate avatar robotate commented on May 2, 2024

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

from 3ree.

GordyD avatar GordyD commented on May 2, 2024

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

from 3ree.

tzarger avatar tzarger commented on May 2, 2024

@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.

from 3ree.

endigo avatar endigo commented on May 2, 2024

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

from 3ree.

tzarger avatar tzarger commented on May 2, 2024

@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?

from 3ree.

endigo avatar endigo commented on May 2, 2024

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

from 3ree.

snobear avatar snobear commented on May 2, 2024

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.

from 3ree.

GordyD avatar GordyD commented on May 2, 2024

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

from 3ree.

ReganHe avatar ReganHe commented on May 2, 2024

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

from 3ree.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.