DEV Community

MarcH1000
MarcH1000

Posted on

Auto-redirect connection to port 4201 and fail

I am creating a website with Angular on WSL2 Ubuntu running on a Windows 10 computer. When I launch the application with the ng serve command, I get ** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ ** and ✔ Compiled successfully. on the command line.
But when I click on the link, the connection is redirected to http://localhost:4201/ and it fails.
By changing 4201 to 4200 in the browser address field, the desired page is displayed.
I did some research without finding any mention of an exactly similar problem, but I nevertheless saw that the easiest way to fix it was to run the ng serve —port 4201 command. It does work, but obviously not anymore when I replace 4201 with 4200 in the browser address field.
Please, see also https://itectec.com/superuser/network-problems-using-wsl2/

Top comments (0)