What type of application is this? The two most likely candidates appear to be Angular and some Virtual Reality applications. Do you have the firewall turned on? These items would make a difference. I'm not clear on what you are doing, making it difficult.
There are a number of mentions in the internet about being unable to open port 4200 because it is already in use. It says that there are ways to change the port used by the ng server.
sudo lsof -i -n -P | grep ":4200" should hopefully list any applications using the port.
Sometimes you can use 127.0.0.1 when localhost doesn't work.
*** *** ****
I was just looking at some more articles, such as https://www.router-switch.com/faq/difference-between-https-port-443-and-8443.html
If you are running https, why are using 4200? I thought 443 and 8443 were the normal ports. If this is a server, what server software are you using.