flutter - Flutter web - 服务器响应状态为 404(未找到),main.dart.js:1
问题描述
从 IDE 直接运行到 chrome 时,Flutter Web 项目可以顺利运行,但是在调用之后flutter build web
,并且托管构建的 Web 应用程序没有打开(只有一个空白页面)并显示此错误,即
Failed to load resource: the server responded with a status of 404 (Not Found)
main.dart.js:1
Failed to load resource: the server responded with a status of 404 (Not Found)
(index):1
Uncaught (in promise) TypeError: Failed to register a ServiceWorker for scope ('http://localhost:8080/') with script ('http://localhost:8080/flutter_service_worker.js'): A bad HTTP response code (404) was received when fetching the script.
解决方案
你没有发布资源/build/web
吗/web
?
推荐阅读
- python - TypeError: test() 缺少 1 个必需的位置参数
- javascript - 等待已经实现的 Promise 的性能开销是多少?
- android - 未找到默认活动,但在清单中指定了默认活动。将 Android Studio 更新到 3.21 后发生的问题
- typescript - 在 Typescript 中设置 NODE_PATH 是不可能的吗?
- php - 如何将数据库中的选定值设置为下拉列表
- c - 在 C 中初始化 UNION 的浮点值
- mysql - 创建触发器更新 SQL 表
- c++ - 为什么 x86-64 使用 IA-64 C++ ABI?
- javascript - 自定义“添加到主屏幕”横幅。在安培
- c - 如何成功地将所有文件 IO 记录放入我的阵列中?