30

It happens arbitrarily, like once every 3 or 4 refreshes, the server just disconnects with this message in the console:

The development server has disconnected.
Refresh the page if necessary.

I looked at one of the other SO posts and my problem seems different because that's about the webpack watcher not connecting, to begin with, in my case it works but disconnects very often. I haven't even ejected the app so not sure why this can be.

  • Not sure. But better if you post your webpack.config file here. – User3250 Apr 10 '18 at 14:41
  • @User3250 I don't have access to that since I haven't ejected create-react-app. CRA hides those files so the user doesn't tamper with them unless you eject. –  Apr 10 '18 at 14:57
  • Post a link to your repo so we can try it locally – Nick Sep 03 '18 at 06:09
  • Hey OP. Are you doing anything non-default in the setup? Got anything weird in your appsettings.json? Where are you running it from? Just command line? VS code? – DMcCallum83 Nov 01 '18 at 15:17
  • Also can you try updating the version of Chrome you're using - can be done from the settings page in the browser – DMcCallum83 Nov 01 '18 at 15:21
  • what OS are you using? – simka Nov 06 '18 at 09:52
  • Presuming you're using chrome, try updating the browser. Last time I saw this, updating either fixed it, or cleared the issue causing it – DMcCallum83 Nov 16 '18 at 12:17
  • Are you perhaps using HTTPS or have some custom reverse proxy settings? – Filip Dupanović Dec 29 '18 at 12:22
  • There is not enough information in your question,but for me most of the time when I get that error it's because of an infinite loop – mssoheil Jan 27 '19 at 06:38
  • 2
    Oddly enough for me, i had this error message every time I clicked a button on a form. I had a `handleClick(event)` method associated to the form. I just added this line in the method `event.preventDefault()` and I no longer got that error message. – CAMD_3441 Apr 03 '19 at 00:45

2 Answers2

2

If you are using Chrome, this might be connected to webpack-dev-server (which create-react-app uses under the hood) issue described here.

Since this has been already addressed by create-react-app team, check the latest available version of react-scripts here: changelog, bump the react-scripts version in your package.json to match it and run npm install (or yarn install) in your project's folder to update to the latest version.

Chmura
  • 21
  • 3
1

I bumped into this when the page was trying to render a huge load of data. Paginated the table and everything worked fine.

Huyen Vu
  • 31
  • 2