Search code examples
flutterdartflutter-web

Flutter web - the server responded with a status of 404 (Not Found), main.dart.js:1


Flutter web project works smoothly when running directly into chrome from IDE, but after calling flutter build web, and hosting the built web app is not opening(only a blank page) and showing this error which is

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.

enter image description here


Solution

  • Did you publish resources not /build/web but /web?