简体   繁体   English

使用 Firebase 托管部署我的 Flutter Web 应用程序后出现错误

[英]Errors after deploying my flutter web app using Firebase Hosting

I've tried to deploy my web app but when I go the the public adress, I have some errors that i can't fix.我已经尝试部署我的网络应用程序,但是当我访问公共地址时,我遇到了一些无法修复的错误。 (I'm testing on Firefox). (我正在 Firefox 上测试)。 I've asked my developper friends but they have no idea how to solve it.我问过我的开发人员朋友,但他们不知道如何解决。

my errors:我的错误:

The script was loaded when its MIME type ("text / html") is not a valid JavaScript MIME type.脚本在其 MIME 类型(“text / html”)不是有效的 JavaScript MIME 类型时加载。

Uncaught SyntaxError: expected expression, got '<' main.dart.js:1未捕获的语法错误:预期的表达式,得到 '<' main.dart.js:1

my index.html:我的 index.html:

 <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>MyAwesomeWebApp</title> <!-- Favicon --> <link rel="icon" type="image/png" href="favicon.png"/> <link rel="manifest" href="manifest.json"/> </head> <body> <script type="application/javascript" src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.min.js"></script> <script type="application/javascript"> pdfjsLib.GlobalWorkerOptions.workerSrc = "//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.4.456/pdf.worker.min.js"; </script> <script type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-app.js"></script> <script type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-analytics.js"></script> <script type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-firestore.js"></script> <script type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-auth.js"></script> <script type="application/javascript" src="https://www.gstatic.com/firebasejs/7.14.0/firebase-storage.js"></script> <script> var firebaseConfig = { apiKey: "azaz", authDomain: "azaz", databaseURL: "azaz", projectId: "azaz", storageBucket: "azaz", messagingSenderId: "azaz", appId: "azaz", measurementId: "azaz" }; firebase.initializeApp(firebaseConfig); </script> <script> if ('serviceWorker' in navigator) { window.addEventListener('flutter-first-frame', function () { navigator.serviceWorker.register('flutter_service_worker.js?v=906927181'); }); } </script> <script src="main.dart.js" type="application/javascript"></script> </body> </html>

Thanks !谢谢 ! :D :D

did you deploy using firebase deploy or firebase deploy --only hosting ?您是使用firebase deploy --only hosting firebase deploy还是firebase deploy --only hosting I had the same issue using the first one.我在使用第一个时遇到了同样的问题。 With the second one, no more issue.有了第二个,就没有问题了。 You can learn more about this on the firebase documentation: https://firebase.google.com/docs/hosting/test-preview-deploy您可以在 firebase 文档中了解更多相关信息: https : //firebase.google.com/docs/hosting/test-preview-deploy

Hope it'll be helpful !希望它会有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase 托管 - Flutter Web extra.ZFC35FDC70D5FC69D2539883A82EZC页面的应用程序托管 - Firebase Hosting - Flutter Web App hosting of extra .html page 将Polymer Web应用程序部署到Firebase托管时,请阅读错误 - READ ERROR when deploying Polymer web app onto Firebase hosting Firebase 托管在部署 Angular 6 应用程序后显示欢迎页面? - Firebase hosting showing welcome page after deploying angular 6 app? Flutter web 应用程序在部署到 firebase 主机后返回空白页 - Flutter web app is returning blank page after being deployed to firebase hosting 使用CircleCI部署到Firebase托管 - Deploying to Firebase Hosting using CircleCI 发布 Flutter Web 应用程序到 Firebase 托管:最近的更改未发布 - Publishing Flutter Web App to Firebase Hosting: recent changes not published Flutter Web App Firebase 主机设置完成屏幕外观? - Flutter Web App Firebase Hosting Setup Complete Screen Appearance? Firebase 托管 Flutter Web App 未清除首次部署的缓存 - Firebase Hosting Flutter Web App not clearing Cache of first deploy Flutter web 在 firebase 托管中不工作 - Flutter web not working in firebase hosting 在 firebase flutter web 项目上部署后显示白色空白页 - After deploying on firebase flutter web project showing white blank page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM