I am using VS code for react. I have the live server extension installed, whenever I try to go live with VS code it shows me a listing directory with all of my folders and files in the browser instead of running my app. Any clue as to why it does this?
4 Answers
You need to provide 'index.html' file in exposed directory. It has to be named exactly like this.('index.html')
More info: https://webmasters.stackexchange.com/questions/30234/the-right-way-of-using-index-html

- 251
- 1
- 6
LiveServer will load the file within the folder in the WORKSPACE assigned to it.
So point to the correct folder and more important, CLOSE active WorkSpaces already opened with LiveServer.
So... Open the Explorer on VSC and close any open "Workspaces" (save your work)
Target the correct index.html file in a new Workspace.
Once it points to the right file then simply right-click and select "open with LiveServer."
It should work.

- 61
- 1
- 1
Just had this error, you have to open the folder using "open folder". It'll be in the editor panel now. And when you go live it takes you to whatever is in the editor panel.

- 63
- 1
- 3
-
1This is a simple fix...Thanks, it solved my issue. – Sayed Sadat Jan 02 '22 at 13:31
You should have a dedicated folder for the file(index.html) to run the code directly in the browser from VS code Live Server.

- 11
- 2