如何在VSCODE中使用Live Server打开2个不同的文件

发布于 2025-01-25 12:46:46 字数 188 浏览 2 评论 0原文

我的Vscode工作区中包含HTML..CSS文件中有2个不同的文件夹 我想用实时服务器打开两个不同的HTML文件。 当我打开第一个时,它说“服务器是在端口上启动的:5500”,它会创建一个新的浏览器窗口,并且可以正常工作,当我尝试打开第二个浏览第二个窗口时,它说“服务器已经从不同的工作区运行”。 我该如何解决? 我读到有人说我可以从其他端口打开它,该怎么做?

I have 2 different folders in my vscode workspace containing html..css files
I want to open the two different html files with live server.
when I open the first one it says "Server is Started at port : 5500" and it creates a new browser window and it works, when I try to open the 2nd one it says "Server is already running from different workspace."
how can I solve this ?
I read someone says that I can open it from a different port, how can I do that ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

疏忽 2025-02-01 12:46:46

您需要更改一台服务器的端口。为此,请转到您的settings.json文件,然后分配值“ liveserver.settings.port”:0到0(对于随机端口)或其他值那不是5500,因此服务器在单独的端口上运行。

有关更多信息,请参阅此答案:
在其中设置值liveserver.settings.port of Visual Studio代码的实时服务器扩展

You need to change the port of one of your servers. To do this, go to your settings.json file and assign the value "liveServer.settings.port": 0 to either 0 (for a random port) or another value that is not 5500 so that the servers are running on separate ports.

See this answer for more info:
Where to set value of liveServer.settings.port in live server extension of visual studio code

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文