Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

localhost:4200 not working for my angular app

Till yesterday, everything was working good. Using cmd, I type ng serve, go to my browser type localhost:4200 and my website fires up. Suddenly today, the localhost is not responding. The ng serve is working properly.

Output after typing ng-serve-

10% building 3/3 modules 0 activei 「wds」: Project is running at http://localhost:4200/webpack-dev-server/
i 「wds」: webpack output is served from /
i 「wds」: 404s will fallback to //index.html

chunk {main} main.js, main.js.map (main) 47.8 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 264 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.15 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 9.7 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 3.81 MB [initial] [rendered]
Date: 2019-09-05T04:20:41.402Z - Hash: a7331d4e748902ef88b7 - Time: 19033ms
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **

I tried different browsers, tried reinstalling angular, still the problem persists.

The message that I get on my browser is - This site can't be reached.


2 Answers

You can try changing your host and your port, something like this:

ng serve --host 0.0.0.0 --port 5000

Maybe it will help...

like image 166
tamar Avatar answered Mar 29 '26 12:03

tamar


With ng serve instead of opening the URL with http://localhost:4200 open with http://0.0.0.0:4200 .

like image 32
Arundhati Mohapatra Avatar answered Mar 29 '26 12:03

Arundhati Mohapatra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!