Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"$ flutter build web" is throwing the error "Missing index.html"?

Tags:

When I run:

$ flutter build web  

I'm getting the error

Missing index.html. 

The flutter app is displaying in the browser, but in VS Code it reads "No Device." How can I debug, or fix this problem?

like image 397
Christopher Castiglione Avatar asked Jun 11 '20 03:06

Christopher Castiglione


People also ask

Does Flutter web use HTML?

Flutter actually controls every pixel that is drawn to the screen and doesn't use HTML, JavaScript, or CSS to define any of its look or logic. (Technically speaking, native Dart code is transpiled to JavaScript through dart2js , but no business logic is actually written in JavaScript.)

How do you get build for web in Flutter?

You must use the channel master for flutter in order to build web version, more details here. After that, just run flutter build web and then, go in root_of_your_app/build/web and run a web server inside like python with python -m http. server 8000 and go to http://localhost:8000 to see your app on any browsers.


1 Answers

It would help to see the output of your flutter doctor, but I am guessing that your project is not configured for web.

If you haven't already, you need to switch to the flutter beta channel like so:

$ flutter channel beta $ flutter upgrade $ flutter config --enable-web 

At this point, running flutter doctor should show that chrome is available.

Then, switch into your application root directory, and run

$ flutter create . 

This will rebuild the project to support web.

Then, from the same directory, you can run flutter build web

like image 88
Alex Collette Avatar answered Sep 19 '22 13:09

Alex Collette