【问题标题】:Flutter App to Web through Github pages blank screenFlutter App to Web 通过 Github 页面黑屏
【发布时间】:2021-12-21 08:31:20
【问题描述】:

我有一个由 Flutter-Web 商店生成的页面,它是一个空白页面。我在控制台中有一个错误。这是在将 Flutter 的构建 Web 上传到 GitHub Pages 之后发生的。

Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('https://adamtechnologynl.github.io/') with script ('https://adamtechnologynl.github.io
/flutter_service_worker.js?v=2470069411'): A bad HTTP response code (404) was received when fetching the script.
manifest.json:1 Failed to load resource: the server responded with a status of 404 ()
manifest.json:1 Manifest: Line: 1, column: 1, Syntax error.
manifest.json:1 Failed to load resource: the server responded with a status of 404 ()
(index):88 Failed to load app from service worker. Falling back to plain <script> tag.
(anonymous) @ (index):88
(index):47 GET https://adamtechnologynl.github.io/main.dart.js net::ERR_ABORTED 404
loadMainDartJs @ (index):47
(anonymous) @ (index):91

【问题讨论】:

    标签: html github-pages flutter-web


    【解决方案1】:

    我找到了解决方案。当您将其放在另一个目录而不是 GitHub 的根目录时,就会发生这种情况。

    所以我的代码在“https://username.github.io/demo/book-king/belasting-web-v1/”中,所以最后一部分我们应该在“https://username.github. io/" 也在 index.html 中。您可以通过修改行来解决它(我的第 17 行):

    变化:

    <base href="/">
    

    进入:

    <base href="/demo/book-king/belasting-web-v1/">
    

    然后你就完成了。

    【讨论】:

      猜你喜欢
      • 2020-12-12
      • 2020-11-07
      • 2023-01-11
      • 2022-10-23
      • 2021-12-23
      • 2021-07-12
      • 1970-01-01
      • 2021-04-19
      • 1970-01-01
      相关资源
      最近更新 更多