I have been trying to launch a html file in Visual Studio Code and I keep getting the message that the page is ‘online, but can’t connect’ (message from the trouble-shooter).
I have tried every solution suggested on the internet and have spent the whole day doing this, but still haven’t found the problem.
Has anyone else had a similar problem with VSC?
Do you have a
<head> and the
<body> in your HTML document?
Important: In order for Live Server to launch your HTML file, it must contain
<body> tags. Without them, Live Server will not run your HTML file and display an error message.
Hello, thank you.
Yes I have the head and body - it’s just a few lines of code:
<title>This is a title</title>
<p>This is text</a>
how to set up, customize and use the Server
Right-click an HTML file in the project and choose “Open with Live Server” from the context menu.Do you have the error ?What is the error?
You might want to use a different port number than the default 5500.
the error is that the site is online but not connecting. I’m not using port 5500…
I can run it locally to see what it looks like when rendered anyway. I will probably just stick to that for now as I have no idea how to fix this.
It also keeps saying that it took too long to respond, if that makes any difference
Try stopping Live Server and then restarting it. Sometimes, issues can be resolved by simply restarting the server,or use the different port…
I tried both, but neither worked. I don’t really know what I’m doing when it comes to ports/servers etc., I just read things and try to figure the bare minimum out. Would you be able to recommend a resource to learn about this stuff? In terms of figuring out the live server, I can’t really spend any more time on it after today. I don’t understand it either, because I had no problems using it last week.
Also - thank you!
VS Code Live Server
Visual Studio Code Live Server Not Working
Open the browser console (usually accessible by pressing F12) and check for any error messages when trying to connect to the live server. This can provide insights into what might be going wrong.
I will give that a try - many thanks for your help.