This is what I see when I open my localhost
I want to make a PWA with Angular so I followed the instructions on the angular.io website to the smallest detail yet it doesn't open the usual "Welcome to your app" page. What might be the problem?
I am have the following installed:
Angular CLI: 6.0.1
Node: 8.9.4
OS: linux x64
Angular: 6.0.1
This is what the console displays when i click on pwaApp and the browser directs me to blank page
What my be the problem? And how can I fix it? Thanks in advance
I am also facing this problem in Angular6 but it can be solved by following steps
ng build --prod
cd dist
cd project_name
npx http-server
127.0.0.1:8080
I found the solution. I had to build the app then cd into the dist and then cd (again) into the built app before http-server -p 8080. The tutorial i followed had just mentioned to cd into the dist and serve, so it wasn't very clear.
Seems you dist folder is empty. Please double check and make sure your build succeed.lite-server Thats what I use often to run my angular app. Take a look at this link https://github.com/angular/angular-cli/wiki/stories-disk-serve. The is that even if you use http-server when you reload the page it will show up a 404 error. Page not found. Best solution is using lite-server.
npm i lite-server -g
Then cd inside the root path of your application and run
lite-server --baseDir="dist"
Your app will run over port 3000
by default.
If you want to run it on a different port so take a look at this answer https://stackoverflow.com/a/35517817/6261137
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With