"$ flutter build web"抛出错误"Missing index.html"? [英] "$ flutter build web" is throwing the error "Missing index.html"?

查看:19
本文介绍了"$ flutter build web"抛出错误"Missing index.html"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跑步时:

$ flutter build web 

我遇到错误

Missing index.html.

Flutter应用程序正在浏览器中显示,但是在VS Code中它显示为"No Device".如何调试或解决此问题?

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

推荐答案

这将有助于查看Flutter Doctor的输出,但我猜您的项目未针对网络进行配置.

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

如果还没有,您需要像这样切换到Flutter Beta频道:

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

这时,运行 flutter doctor 应该会显示chrome可用.

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

然后,切换到您的应用程序根目录,然后运行

Then, switch into your application root directory, and run

$ flutter create .

这将重建项目以支持Web.

This will rebuild the project to support web.

然后,从同一目录中,您可以运行 flutter build web

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

这篇关于"$ flutter build web"抛出错误"Missing index.html"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆