Live server installed but not working in VS code
Solution 1:
Re-install the extension and restart your text editor to fix the issue.
Solution 2:
I had this problem and I solved it by changing the port number in the settings.json
file to an opened one.
To get to the settings.json
file you just click CTRL+SHIFT+P, then type "settings", click the "Preferences: Open Settings (JSON)", then paste this inside the { }
:
"liveServer.settings.port": 0
This will randomly pick an opened port each time. This is how my JSON file looks like:
{
"liveServer.settings.port": 0
}
If there are multiple lines in the JSON file, make sure each line is separated by a comma(,
), like this:
{
"liveServer.settings.CustomBrowser": "microsoft-edge",
"liveServer.settings.port": 0
}
Solution 3:
If live server is not runnning and rendering html page on port 5500,for example http://127.0.0.1:5500/index.html not working.
Then this may be due to connection issue on your system.
I had same problem when i was compiling below html page:
<!DOCTYPE html>
<html>
<body>
<h1>Hello world</h1></body>
</html>
Solved it by changing live server settings to my local IP and it fixed issue.
My local ip: http://192.168.2.16:5500/index.html is rendering changes on fly and working.
For steps, you can refer: https://www.youtube.com/watch?v=_B3RRVhgCOw
This works for anyone for whom live server is not running by default with port 5500.