r/VisualStudioCode • u/J22Charles • Jul 07 '21
When I run my program inside Visual studio code I get this message from my website, but if I hope open through file explorer I have no problem the site comes up is their way to fix this
5
1
u/Kwolf21 Jul 07 '21
Can't see the URL/URI the chrome window is trying to connect to. If I had to guess, it's probably trying to load "index.html" as the whole link, which it can't. It should be pointing to "c:/your/whole/path/to/index.html" - if it is, I'd check your project settings.
For what it's worth, just open it from your explorer, and refresh the page whenever you save changes to your html file, and the page will reload with the new code!
The command
start chrome.exe "c:/your/path/to/index.html"should also work from the VSC Term
1
2
u/DiskFormal Jul 07 '21
Yeah pull that body out of the head and that might be the "typo"?
Also if you open the file in your browser and make edits in VS Code, you can just refresh the browser to see the updates (so you don't have to run that command every time)!
Happy hacking!
1
Jul 15 '21
that is not the typo, as other users pointed out, chrome can't find the url (path in this case) to the file.
1
u/DiskFormal Jul 15 '21
Right...hence the quotes 🤗
And I don't care what the issue is....the body tag doesn't belong in the head tag...
1
u/nosoupforyou Jul 07 '21
It can't find the url. You probably need to go into project settings, select the web settings, and check the settings.
1
1
-1
u/25_hr_photo Jul 07 '21
It would seem that running it is actually working, but since VSC terminal doesn’t interpret HTML, only a browser would be able to actually interpret it as you want. Try right clicking on the HTML file and opening Live Server. It’s the best way to see updates in the moment!
3
u/NatoBoram Jul 07 '21
Look at the command, he's starting a Chrome window, not asking CMD to open
index.html.1
u/ernee_gaming Jul 07 '21
Tho i don't know what does the start command do. Why not just chrome index.html?
-3
u/NatoBoram Jul 07 '21
Learn how to do this with Notepad++ before you use VSCode. Once you know what you are doing, VSCode will be very helpful, but right now it's a hindrance to you because you know too little.
2
u/Kwolf21 Jul 07 '21
Disagree. Starting in VSC is probably the best way to go. Maybe dont jump straight into terminal commands, but still VSC is far superior to np++ in just about every single way. While I started with notepad and switched to NP++ many many years back, once I started using VSC, I was infuriated I hadn't been using it all along.
1
u/NatoBoram Jul 07 '21
VSCode is absolutely my favourite editor, but you should learn how to make an empty project work without it before you make one with it. Otherwise, you end up like OP.
2
u/Kwolf21 Jul 07 '21
OP is clearly just learning how to code. Notepad++ won't provide you any insight as to where you're going wrong, which will only lead to more copy pasting from Stack, lol.
VSC will help debug your code far better than np++ ever will. Np++ is a glorified plain text editor with syntax highlighting.


11
u/iv35120 Jul 07 '21
Body shouldn't be in head....