Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot GET /index.html #8

Closed
i-oliva opened this issue Feb 10, 2018 · 34 comments
Closed

Cannot GET /index.html #8

i-oliva opened this issue Feb 10, 2018 · 34 comments

Comments

@i-oliva
Copy link

i-oliva commented Feb 10, 2018

I try to F1 -> Show live server preview and this appears...

image

Using v.1.21.0-insider

@LizKeay
Copy link

LizKeay commented Feb 15, 2018

I am getting the same issue. I've reinstalled vscode with version 1.20.1 and reinstalled the preview plugin.

@i-oliva
Copy link
Author

i-oliva commented Feb 20, 2018

@andersonaddo
Copy link

#7 I think the issue is coming from the fact that pro program is confused between / path separators and \ path separators.

@Almenon
Copy link

Almenon commented Mar 11, 2018

I got this issue when I had two workspaces open. Switching to just one workspace fixed it.

@Dmitri801
Copy link

Hi, I'm having this same exact issue, I only have 1 workspace open. also when I try to use https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer:

It says it needs a body and html tag, but the html does have a body and html tag. any thoughts or solutions?

@negokaz
Copy link
Owner

negokaz commented Apr 14, 2018

Sorry for the late reply.
I will work on this issue.

negokaz added a commit that referenced this issue Apr 15, 2018
@negokaz
Copy link
Owner

negokaz commented Apr 15, 2018

@Pavilion @LizKeay @Dmitri801
I improved path resolving in v0.1.2. Please try the version.

@LizKeay
Copy link

LizKeay commented Apr 16, 2018

Thanks - issue resolved for me.

@negokaz negokaz closed this as completed Apr 16, 2018
@bilaljaved786
Copy link

Thanks - issue resolved for me.

how you solved it

@HarryAdney
Copy link

HarryAdney commented Nov 22, 2019

In case it helps anyone else, I originally named my distribution folder as "public_html" and got this error. I renamed it to "public" and updated the config files, etc. restarted VS Code and it worked fine.

@lolaloka
Copy link

lolaloka commented Feb 2, 2020

rename it to another name and it will work fine

@ccomstudio
Copy link

ccomstudio commented Sep 21, 2020

Yes, it works only for files from one workspace (one ancestor folder). The best way to check where it is busy/blocked is by pasting http://localhost:8080/ into your browser. Close everything in your workspace open again where you want it and that will sort it

@GWBSU
Copy link

GWBSU commented Nov 11, 2020

I had this issue and solved it by removing special characters from my file name. I had a file with #2 in the name, I removed the # from the title and everything worked fine.

@Redyier
Copy link

Redyier commented Nov 17, 2020

If you are using live server on Explorer go to Live share and under section Shared Servers just click on Live Server.

image

@ccomstudio
Copy link

I had that message when another file was opened in that extension. Just close all the folders in the File menu of the VScode and that should solve it.

@vahidavadiya
Copy link

Thank you @ccomstudio I had the same issue in folder name I have used '&' removing special character solved my problem.

@harshgajera101
Copy link

I had just disable all the extensions which were working , and then i enabled it again and it started working as same as before..
I think this might help you.

@Umama-Nayyer
Copy link

i were stuck with the same issue but resolved it finally.
here is how:
i were only opening my file which is "index.html" in visual studio code but then i closed the file and opened the folder which contains that file in vs code. after that i used " open with live server by right clicking " and here it worked.

@alexanderhipe
Copy link

I got this issue when I had two workspaces open. Switching to just one workspace fixed it.

Same as mine, so it means that the live server will work only for 1 workspace..

@ShubhamBohra0009
Copy link

I had the same problem but here is the solution .
The file you're trying to see through live server might be in a folder which is co-folder of some other folder let say folder name A. And this problem arise when we open the vscode through folder A rather than the exact co-folder in which our file exist. so just close the vscode. open it in that particular co-folder and you're good to go. :)

@ZackInMA
Copy link

ZackInMA commented Dec 1, 2021

It seems the issue is that if the path contains JavaScript keywords, it breaks.
Screenshot

Red = broken. Green works.

The difference? The broken one contains the JavaScript keywords LET and CONST in the path... That's the only difference I can see. I validated this by renaming the folder to "test" and it worked after that. So the folder name having JS keywords seems to be the issue here.

@kaioqrz
Copy link

kaioqrz commented Jan 21, 2022

I had this issue and solved it by removing special characters from my file name. I had a file with #2 in the name, I removed the # from the title and everything worked fine.

thanks!!!

@Mac4ttack
Copy link

Mac4ttack commented Feb 9, 2022

I just ran into this issue and it was the "&" in the folder name. Changed to "and" fixed all issues.

Previously, with the "&" I could still use the option to "Go Live" in the bottom right corner of VSC and navigate to the index.html in that folder name and it worked fine. However, right-clicking to "Open with live server" ended in an Error: Cannot GET /HTML%20%5E&%20CSS/x/index.html

It seems the issue is that if the path contains JavaScript keywords, it breaks. Screenshot

Red = broken. Green works.

The difference? The broken one contains the JavaScript keywords LET and CONST in the path... That's the only difference I can see. I validated this by renaming the folder to "test" and it worked after that. So the folder name having JS keywords seems to be the issue here.

@busybee23
Copy link

A very simple change worked for me, just try changing your folder name in which your files are present, sometimes if your folder container has too many symbols and characters with spaces in it, change it to something simple without many characters.
Especially the '&' character.

@Shaimaa-Hassan
Copy link

i have the same problem i still can not solve it

@Brendan-A-Wilson
Copy link

@busybee23 Thanks, that worked for me. The '&' character in the folder name was the issue for me.

@onwuemenejoshua
Copy link

I resolved mine by removing the special character "&" from my folder name

@busybee23
Copy link

@busybee23 Thanks, that worked for me. The '&' character in the folder name was the issue for me.

No worries sir.

@Anandkokane
Copy link

you created index.html file which is resides in (eg:xyz) folder.
next when you was trying to open that file with the help of live server you got the error like 404 can't get
i had also facing the same error but after passed 30 min i got it solution
let's go look a few steps
1)you got an error cause you only putinig filename in path
error1

2)but you created index.html file it's actually resides in Project folder(folder name can be anything )
error2

3)you have to put full path in your browser just like this (/foldername/filename) after that you will render the your index.html page.
error3

Thank you :)

@gentiles
Copy link

just update the vscode

@Dumte
Copy link

Dumte commented Feb 26, 2023

who got a solution to this problem? i'm having the same issue

@Danyllo-Mendanha-dev
Copy link

Basta você renomear o arquivo index.html , pois pode estar ocorrendo um sobrepujamento de arquivos com nomes iguais, nesse caso (index.html), assim é só salvar o novo nome do arquivo e executar o servidor "LiveServer".

@theMHD-120
Copy link

#7 I think the issue is coming from the fact that pro program is confused between / path separators and \ path separators.

Thank you very much bro...
I had used & (ampersand) in one of my repository folders and got this error...
By changing it, my problem was solved! :)
...

@codingwalebhaiya
Copy link

I solved this issue by removing special characters like &.
my folder name before issue - drag & drop
my folder name after resolving the issue - drag and drop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests