在Visual Studio代码的实时服务器扩展中设置liveServer.settings.port的值的位置

问题描述 投票:1回答:2

我正在使用Visual Studio代码编辑器URL处理Angular7:http://localhost:4200(工作正常)

但是,我安装了扩展Live Server,当我点击Liveserver图标时,它给了我错误

“端口5500出错。请尝试通过设置更改端口或在GitHub上报告。”

所以,我打开了File-> preference-> Settings-> LiveServerConfig并试图在settings.json文件中更改端口

{
    "typescript.tsdk": "./node_modules/typescript/lib",
    "tslint.enable": false,
    "liveServer.settings.multiRootWorkspaceName": "QiwkCollaboratorTool",
    "liveServer.settings.root": 0  // New added line
}

我是朝着正确的方向前进还是错过了什么?我不知道如何将端口号5500更改为0,因为我想要随机端口号。

提前致谢!

visual-studio-code port-number liveservertestcase
2个回答
1
投票

我希望这有帮助:在settings.json中添加以下行。

"liveServer.settings.port": 0,

值0(零)用于随机端口。任何其他数字用于固定端口号。


1
投票

我得到了答案我正在编辑错误的settings.json有两个.json文件。

enter image description here

另外,我把下面的代码:

{
    "liveServer.settings.multiRootWorkspaceName": "",
    "liveServer.settings.port": 0,
}

[,]逗号最后无关紧要。

但谢谢丹尼

© www.soinside.com 2019 - 2024. All rights reserved.