silviolleite / laravel-pwa

Looks like an app, feels like an app, but IS NOT an app.
MIT License
969 stars 155 forks source link

no matching service worker detected #18

Open martindufresne opened 4 years ago

martindufresne commented 4 years ago

When I try to check if everything is working, I get this error. Yet everything seems ok. Someone had this problem? And if so, does anyone have a track to fix that? Thank you in advance!

Screenshot from 2019-12-04 16-42-14 Screenshot from 2019-12-04 16-42-22

TheFreeman15 commented 4 years ago

Same issue for me

paulchiu commented 4 years ago

Fix below:

--- a/resources/views/modules/laravelpwa/meta.blade.php
+++ b/resources/views/modules/laravelpwa/meta.blade.php
@@ -34,7 +34,7 @@
     // Initialize the service worker
     if ('serviceWorker' in navigator) {
         navigator.serviceWorker.register('/serviceworker.js', {
-            scope: '.'
+            scope: '/'
         }).then(function (registration) {
             // Registration was successful
             console.log('Signage Lab PWA: ServiceWorker registration successful with scope: ', registration.scope);
Xoshbin commented 4 years ago

For me it did not work locally but worked on production.

Shi974 commented 4 years ago

For me it was because some files were not cached because they were missing. In your Developer Toolbar, go to Network and check if there are no errors. Then comment them in your serviceworker.js.

nachete1987 commented 4 years ago

same problem here, I test with scope / and . and only in production works :(

alemurillo104 commented 4 years ago

same problem here, I test with scope / and . and only in production works :(

does it work for you using '.' on production? for me, it works on localhost but it doesnt in production :( heeelp

Heena-Naaz commented 3 years ago

Fix below:

--- a/resources/views/modules/laravelpwa/meta.blade.php
+++ b/resources/views/modules/laravelpwa/meta.blade.php
@@ -34,7 +34,7 @@
     // Initialize the service worker
     if ('serviceWorker' in navigator) {
         navigator.serviceWorker.register('/serviceworker.js', {
-            scope: '.'
+            scope: '/'
         }).then(function (registration) {
             // Registration was successful
             console.log('Signage Lab PWA: ServiceWorker registration successful with scope: ', registration.scope);

got this by googling the whole day. Thanks a lot, @paulchiu for posting

dragonfly4 commented 3 years ago

@paulchiu Thank you! This should be by default as I spent a lot of time debugging why it wasn't working 😝

romel-gag commented 1 year ago

On Laravel 10, its the filesToCache array, I removed app.css and app.js.