pwa icon indicating copy to clipboard operation
pwa copied to clipboard

Failed to load service-worker.js

Open olivbau opened this issue 7 years ago • 6 comments

I have an error after a fresh install. Here is the steps:

  • init a PWA project
  • host it on a https server
  • reach it
  • refresh 2 times to be sure that all stuff is in cache
  • check the offline mode
  • got this error
An unknown error occurred when fetching the script.
Failed to load resource: net::ERR_INTERNET_DISCONNECTED service-worker.js 

screenshot_2017-10-19_23-15-52

I'm just discovering PWA and service-worker, but is this normal ?

olivbau avatar Oct 19 '17 21:10 olivbau

I've spent all of today trying to fix this :-(

dbilovd avatar Oct 21 '17 16:10 dbilovd

Do you have clues/lines of research?

EDIT 14 Nov 2017 : Problem still persist :weary:

olivbau avatar Oct 21 '17 17:10 olivbau

What browser extensions are you using?

johnathankent avatar Feb 15 '18 20:02 johnathankent

I'm not sure to understand, you mean on Chrome ? Nothing special, JSON Formatter, uBlock Origin, Vue.js devtools, and schedule synchro

olivbau avatar Feb 15 '18 20:02 olivbau

I found this:

Note: In Chrome, you may see a console error indicating that the service worker could not be fetched: An unknown error occurred when fetching the script. service-worker.js Failed to load resource: net::ERR_CONNECTION_REFUSED. This error is shown because the browser couldn't fetch the service worker script (because the site is offline), but that's expected because we can't use the service worker to cache itself. Otherwise the user's browser would be stuck with the same service worker forever!

https://google-developer-training.gitbooks.io/progressive-web-apps-ilt-codelabs/content/docs/lab_workbox.html

joserick avatar May 20 '18 21:05 joserick

Just remove existing registered service workers. The method depends on the browser you developed on.

noomz avatar Jan 19 '21 11:01 noomz