如何在VSCODE中使用Live Server打开2个不同的文件
我的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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要更改一台服务器的端口。为此,请转到您的
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