title: Progressive web app Uncaught (in promise) TypeError: Failed to fetch
body: <p>I started learning PWA (Progressive Web App) and I have problem, console "throws" error Uncaught (in promise) TypeError: Failed to fetch.         </p>
  
  <p>Anyone know what could be the cause?</p>
  
  <pre><code>let CACHE = 'cache';
  
  self.addEventListener('install', function(evt) {
      console.log('The service worker is being installed.');
      evt.waitUntil(precache());
  });
  
  self.addEventListener('fetch', function(evt) {
      console.log('The service worker is serving the asset.');
      evt.respondWith(fromCache(evt.request));
  });
  function precache() {
      return caches.open(CACHE).then(function (cache) {
          return cache.addAll([
              '/media/wysiwyg/homepage/desktop.jpg',
              '/media/wysiwyg/homepage/bottom2_desktop.jpg'
          ]);
      });
  }
  function fromCache(request) {
      return caches.open(CACHE).then(function (cache) {
          return cache.match(request).then(function (matching) {
              return matching || Promise.reject('no-match');
          });
      });
  }
  </code></pre>