title: Uncaught FirebaseError: Messaging: This method is available in a Window context
body: <p>I'm using Firebase service worker for web push notification. Currently, I am facing this error:</p>
  
  <pre><code>Uncaught FirebaseError: Messaging: This method is available in a Window context. (messaging/only-available-in-window).
  </code></pre>
  
  <p>I am using a website on my desktop to register the SW. How do I resolve this issue?</p>
  
  <p>Error stack I'm getting in console.</p>
  
  <pre><code>browserErrorMessage: "Failed to register a ServiceWorker: ServiceWorker script evaluation failed"
  code :"messaging/failed-serviceworker-registration"
  message :"Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker: ServiceWorker script evaluation failed (messaging/failed-serviceworker-registration)."
  stack: "FirebaseError: Messaging: We are unable to register the default service worker. Failed to register a ServiceWorker: ServiceWorker script evaluation failed (messaging/failed-serviceworker-registration).↵    at https://www.gstatic.com/firebasejs/3.7.0/firebase.js:555:225"
  __proto__: Error
  </code></pre>
  
  <p>Thank you</p>