我正在使用Visual Studio代码编辑器来开发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,因为我想要随机端口号。
谢谢!
答案 0 :(得分:2)
Settings
(Ctrl+Comma)。
ScreenshotExtensions
。
ScreenshotLive Server Config
Edit in settings.json
下的 Settings: Port
。
ScreenshotCtrl+s
。liveServer.settings.port:自定义 Live Server 的端口号。如果要随机端口号,设置为0。
答案 1 :(得分:1)
我希望这会有所帮助: 在settings.json中添加以下行。
"liveServer.settings.port": 0,
值0(零)用于随机端口。其他任何数字均用于固定端口号。
答案 2 :(得分:1)