简体   繁体   English

vs 代码实时服务器扩展不工作

[英]vs code live server extension not working

I'm trying to run a basic html file with live server extension, when I run it I get the Server is Started notification(as shown in the img below) but then nothing happens我正在尝试运行带有实时服务器扩展的基本 html 文件,当我运行它时,我收到服务器已启动通知(如下面的 img 所示),但随后什么也没有发生在此处输入图像描述 even manually going to port 5500 like "http://127.0.0.1:5500/index.html" I get the following error即使像“http://127.0.0.1:5500/index.html”这样手动转到端口 5500,我也会收到以下错误

Cannot GET /index.html无法获取/index.html

i tried restarting vs code.我尝试重新启动 vs 代码。 uninstalling and reinstalling live server extension also tried uninstalling and reinstalling vs code.卸载并重新安装实时服务器扩展还尝试卸载并重新安装 vs 代码。 i set the default browser in the extension settings and on my computer any other ideas i can try would be appreciated我在扩展程序设置和我的计算机上设置了默认浏览器我可以尝试的任何其他想法将不胜感激

Thank you谢谢

I'm not sure why but changing file names (removed special characters) worked only if i do it manually it still doesn't load the browser automatically though..我不知道为什么,但更改文件名(删除特殊字符)只有在我手动操作时才有效,但它仍然不会自动加载浏览器..

This could be the issue I just solved.这可能是我刚刚解决的问题。

VS code was not using the local IP as a host. VS 代码未使用本地 IP 作为主机。

Manage > settings > search "use local" or "live server"> check "use local IP as host".管理 > 设置 > 搜索“使用本地”或“实时服务器”>勾选“使用本地 IP 作为主机”。

I hope that helps you or your connection needs could be unique and you might want to look at this guide.我希望这对您有所帮助,或者您的连接需求可能是独一无二的,您可能需要查看本指南。 https://code.visualstudio.com/docs/setup.network https://code.visualstudio.com/docs/setup.network

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM