React native + expo + Notifications = 你必须在 `app.json` 中提供 `notification.vapidPublicKey` 才能在网络上使用推送通知

Wil*_*iam 6 push-notification react-native expo

我一直在 RN 上构建一个应用程序,静态内容按预期工作。现在我正在尝试添加推送通知,所有尝试都导致我出现此错误:You must provide 'notification.vapidPublicKey' in 'app.json' to use push notifications on web..

周围有几个教程,它们看起来都很简单,而且没有一个有这个错误......

所以,我已经尝试了 5 个以上的教程,使用 Node 14、react-native-web 0.11.7(由于异步问题),包括owner,slugnotification.vapidPublicKeyon app.json(最后一个不被文件接受),以及很多其他的东西,就像尝试将其用于一个全新的项目一样。

当我await Notifications.getExpoPushTokenAsync()import { Notifications } from 'expo';.

"dependencies": {
  "@expo-google-fonts/inter": "^0.1.0",
  "expo": "~37.0.3",
  "moment": "^2.27.0",
  "react": "~16.9.0",
  "react-dom": "~16.9.0",
  "react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
  "react-native-screens": "~2.2.0",
  "react-native-web": "0.11.7"
},
"devDependencies": {
  "@babel/core": "^7.8.6",
  "@types/react": "~16.9.23",
  "@types/react-native": "~0.61.17",
  "babel-preset-expo": "~8.1.0",
  "styled-components": "^5.1.1",
  "typescript": "~3.8.3"
},
Run Code Online (Sandbox Code Playgroud)

有关如何解决此错误的任何想法?