Skip to content

Failed to register a ServiceWorker for scope #1

Description

@DnlCYan

Does running this project simply by 'ng serve' do activate the service worker and consequently the SWUpdate?
I believe not, because default configuration is development and not production. So I can't understand how can you present screens of update.

Even when I change default to production or run 'ng serve -c production', it tries to activate the service worker but it doesn't work well.
It gives me this error:
main.js:1 Service worker registration failed with: TypeError: Failed to register a ServiceWorker for scope ('http://localhost:4200/') with script ('http://localhost:4200/ngsw-worker.js'): A bad HTTP response code (404) was received when fetching the script.

I think you can't run a PWA with service worker using 'ng serve'. One must build and run the application in a server like iis or http-server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions