javascriptvisual-studio-codeliveserver

VS Code Live Server will not load Index.html with error ERR_CONNECTION_RESET until it succeeds with no clear justification


I'm development a small JavaScript application with one HTML file, one JS file and the inclusion of 2 libraries (bootstrap and font awesome). Also, I installed the Live Server plug.

When I open VS-Code, click on the Index.html file and then the "Go Live" button, the browser opens, thinks for a while and then an error message is displayed at the console with ERR_CONNECTION_RESET code.

I then try switching browsers (between Edge and Chrome) back and forth, restart things a number of times without making any change to the code or configuration (except the browser switching) till, unexplainably, the file is successfully loaded and hence development can proceed.

Though eventually I'm able to proceed with my work, the above process takes quite some time and it is extremely annoying. Also, the fact that I have no explanation about the reason for this strange condition keeps me puzzled.

The page is built as a set of nested tables and, in one of these tables, the tags are <body> ... </body> (accidentally) instead of <tbody> ... </tbody>.


Solution

  • See https://github.com/ritwickdey/vscode-live-server/issues/1131, where it's shown that Live Server trips up if you have weird / messed-up </body> tags in your source code anywhere.

    This was found to be the case in the comments under the question. The asker of this question had a typo where they meant to write </tbody>, but instead wrote </body>. Normally typo-caused questions should be closed, but this is an exception because there's actually something valuable to be learned here that future readers can benefit from.