FirebaseError-消息传递/服务工作人员注册失败 [英] FirebaseError - messaging/failed-serviceworker-registration

查看:87
本文介绍了FirebaseError-消息传递/服务工作人员注册失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这很重要,我已经在Stackoverflow中问了几个与Firebase相关的问题,即使没有任何答案,我也设法使Firebase正常工作,并收到了很多通知.我真的不知道我做了什么使它起作用,这是很多事情的组合.

Okey here is the deal, I have asked a couple of firebase related question already in Stackoverflow, and even without any answers I managed to get firebase working, and received a bunch of notifications. I really don't know what I did to make it work, it was a combination of lots of things.

(先前发布的相关问题:如何使用webpack将Firebase云消息传递包含到ReactJS项目中 |

(Related issues posted earlier: How to include firebase cloud messaging into ReactJS project using webpack | Firebase FCM with ReactJS and Webpack not working: We are unable to register the default service worker)

无论如何,现在它不再起作用.我试图简化一些配置等.然后我弄坏了服务人员.

Anyhow, now it is not working again. I tried to simplify some configurations etc. and I broke the service-worker.

现在,当我尝试注册默认的Firebase Service-Worker时,出现以下错误.当我在地址栏中输入localhost:8000/firebase-messsaging-sw.js时,文件会打开.

Now when I am trying to register the default firebase service-worker, I get the following error. When I type localhost:8000/firebase-messsaging-sw.js into my address bar, the file opens up though.

令我迷惑的是,窗口未定义错误",因为我不知道为什么会这样.当我打开文件的来源时,得到以下代码行:

The thing that mystifies me is that "window is not defined error" since I have no idea why it is giving that. When I open up the file where it is coming from, I get this line of code:

请注意,我在那里有一个firebase-messaging-sw.js文件作为工作程序运行,打开该文件会打开一堆代码,因此firebase已注册了一些东西.

Notice that I have the firebase-messaging-sw.js file running as a worker there, and opening that file opens a bunch of code, so something is registered by firebase.

我要问的是:如何摆脱这些Firebase/消息传递无法注册默认的Service Worker错误,并且未定义该窗口错误,并使FCM运行稳定?

WHAT I AM ASKING IS: How do I get rid of these firebase/messaging cannot register the default service worker errors, and that window is not defined error, and get FCM running stable?

推荐答案

我设法解决了我的问题(再次没有任何答案..).我需要将webpack-dev-server从2.11.1降级到2.11.0!我希望这可以帮助其他人遇到这个问题.

I managed to solve my problem (again without any answers..). I needed to downgrade webpack-dev-server from 2.11.1 to 2.11.0! I am hoping that this might help someone else having this issue.

这篇关于FirebaseError-消息传递/服务工作人员注册失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆