Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Localhost throwing invalid response after running http-server for Angular PWA

I have installed PWA to my Angular application by ng add @angular/pwa and followed the all necessary steps.

To run PWA locally I have installed http-server globally by npm i -g http-server

After building production by ng build --prod, I ran http-server -o from dist folder but localhost is not working and throwing invalid response.

I have tried with different ports by http-server -p 5000 but it's not working.

like image 665
Siva Kumar S Avatar asked Sep 18 '25 16:09

Siva Kumar S


1 Answers

We need to execute "http-server -o" command from dist/ and not from dist.

Also as mentioned in https://github.com/http-party/http-server/issues/525 I had to access using http://127.0.0.1:8080/index.html instead of http://127.0.0.1:8080/

like image 167
phoneynk Avatar answered Sep 21 '25 06:09

phoneynk