Could not subscribe to notifications Error: Service workers are disabled or not supported by this browser

Could not subscribe to notifications Error: Service workers are disabled or not supported by this browser

我正在按照 https://blog.angular-university.io/angular-push-notifications/#:~:text=Push%20Notification%20Demo,a%20Notification%20to%20the%20user.

中给出的步骤进行操作

我正在尝试使用 angular 获取推送通知。但是在收到推送通知时,我收到了一个错误

我已经完成了 service worker 设置。但是不知道为什么会出现这个错误

Service Workers 不能与 ng serve 一起工作。像下面这样使用 http-server :-

首先安装一个http-server

npm i -g http-server

构建您的项目

ng build --prod

内部 dist 运行

http-server