当我尝试使用 Firebase 托管的 Flutter 网站时遇到此错误。这是我在flutter项目根目录下执行的命令:
flutter build web
然后我按照指示将
script tag
添加到 build/web/index.html
npm install -g firebase-tools
firebase login
firebase init //or// firebase init hosting
(与第一个选项无关,您只需在选项中指定即可)
*Then I change the "source" in the firebase.json file:*
"hosting": {
"source": "build/web",
"ignore": [...
firebase deploy
运行后
firebase deploy
我收到错误:
错误:无法检测正在使用的 Web 框架,请检查 firebase-debug.log 以获取更多信息。
我读过的唯一解决方案是降级 firebase,但是当我从
13.0.2
降级到 12.4.0
(遇到此错误后推荐)时,没有任何反应,我仍然收到错误。
对我来说,我按照官方给出的链接中的步骤重新配置 Flutter Web https://firebase.google.com/docs/hosting/frameworks/flutter
对我来说效果很好! 🚀
注意:在继续执行上述步骤之前,请确保重新验证您的 Firebase,您可以使用以下命令来执行此操作
firebase login --reauth
或者您也可以尝试重新登录
$ firebase logout
$ firebase login