Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to set value of liveServer.settings.port in live server extension of visual studio code

I am working on Angular7 with visual studio code editor URL: http://localhost:4200 (Working fine)

But, I installed extension Live Server and when I click on Liveserver icon its giving me the error

"Error on port 5500. Please try to change the port through settings or report on GitHub."

So, I opened the File->preference->Settings->LiveServerConfig and tried to change port in settings.json file

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

Am I going into right direction or am I missing something ? I am not sure how to change the port number 5500 to 0 as I want random port number.

Thanks in advance!

like image 691
Swapnil G Thaware Avatar asked Mar 30 '19 08:03

Swapnil G Thaware


People also ask

How do I change the visual number in port code?

In Solution Explorer, right-click the name of the web application and select Properties. Click the Web tab. In the Servers section, under dropdown selection for IIS Express, change the port number in the Project URL box. To the right of the Project URL box, click Create Virtual Directory, and then click OK.


2 Answers

I got the answer I was editing the wrong settings.json there were two .json files.

enter image description here

Also, I put the below code:

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

But thanks Danny

like image 89
Swapnil G Thaware Avatar answered Sep 20 '22 19:09

Swapnil G Thaware


I hope this helps: in the settings.json add the following line.

"liveServer.settings.port": 0,

A value 0 (zero) is used for a random port. Any other numbers is for a fixed port number.

like image 33
Danny Acosta Avatar answered Sep 18 '22 19:09

Danny Acosta