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
}
Answer from Elyasaf755 on Stack OverflowVideos
Hi! Something is wrong with my vscode or live server or something, and I don't know what to do. My teacher thinks there's something wrong with my php server extension. I am trying to write php code through xampp and vscode. It has worked the entire semester until now. When I try to look at the file in the browser through live server it doesn't work. I see a view of the files in my directory, and if I click them I just download them.
and I get these error messages:
I tried changing the path in the settings.json file to this:
"php.validate.executablePath": "C:\\xampp\\php\\php.exe"
(since I saw in my file explorer that it was actually located in the php directory, and not directly in the xampp folder.) The problem persists, but now I don't get the error messages anymore. I have also tried redownloading xampp and the live server extension, but it did not solve the problem.
When I open up a php-file in the browser I used to be able to just double click it in the file explorer and it opened up in my default browser. Now if I double click it it opens up in vs code instead, and if I right-click it and select open with > Choose another app, I only get Firefox as an option for a browser even though I use Brave for default and also have Chrome and Internet explorer downloaded, which is also weird and used to work differently. (I use windows) When I open the file in Firefox, the php code doesn't read right and apache is started in xampp Control Panel. The code looks like this:
The only way I can see the file correctly is if I write localhost/directoryname as a url, but then the code doesn't update manually.
My university teacher does not know how to help me. We have tried multiple things but she told me I could try to ask in a forum so... Does anyone know what has happened? My best guess is that some setting has changed without me knowing it. What can I do? Thanks so much in advance. / Ida
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
}
Re-install the extension and restart your text editor to fix the issue.
So I have a decent knowledge of CSS and HTML, so I decided to finally use VC, since I was scared my 2020 Intel MacBook may not support it. Anyways, so I had some confusing moments, but after time, I understand how to use app at least at the most basic way, and in order to test it, I created a file and downloaded addon called “Live Served”, because I saw that lots of people use it. Now, the issue I encountered was basically that when it loads the page, my code is shown, however, whether it is infinite amount of refreshes or just one really long one, it basically doesn’t show other code I have wrote and only way to see my added code is to close and open the Live Server. Who knows how to deal with this? I have <meta charset = “UTF-8”> and I have no problem with starting local server. There are two things I should say that can be a reason of this happening (theoretically):
I tried to deal with this issue on my own, so I decide to google the solution, and redditors and users from few other websites said that for some of them changing Settings > Commonly Used > Auto Save to afterDelay helped them, and I did too.
This is more reasonable reason, basically my Mac is only 1.1GHz with i5 Intel Core, so the laptop is generally weak, so it could be a reason.
Any help would be appreciated!
(I will put a video too; please ignore the text, it was just me being bored with testing and the issue itself)
J'ai commencé à apprendre maintenant, donc je ne comprends pas encore très bien. J'ai installé l'extension Life Server pour VSCode et quand j'ouvre le HTML, ça ne marche pas, ça ne se met pas à jour tout de suite et ça ne répond à aucune modification sur la page du navigateur que j'ai ouverte. Quelqu'un sait comment je peux résoudre ça ?