Flutter web - 服务器响应状态为 404(未找到),main.dart.js:1

Flutter web - the server responded with a status of 404 (Not Found), 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吗?