【发布时间】:2020-07-02 01:18:04
【问题描述】:
我使用official guide 安装了 Flutter 测试版。 启用网络:
flutter channel beta
flutter upgrade
flutter config --enable-web
结果是:
Setting "enable-web" value to "true".
You may need to restart any open editors for them to read new settings.
flutter devices 命令的结果:
>flutter devices
1 connected device:
Web Server • web-server • web-javascript • Flutter Tools
官方指南指出应该有两个设备:
Chrome • chrome • web-javascript • Google Chrome 78.0.3904.108
Web Server • web-server • web-javascript • Flutter Tools
我根据官方指南创建了示例应用程序并尝试构建它:
flutter create myapp
cd myapp
flutter run -d chrome
结果是:
No devices found with name or id matching 'chrome'
已安装最新的 Google Chrome。我已阅读on github 可以通过设置环境变量 CHROME_EXECUTABLE 来解决问题。我尝试使用 chrome.exe 的路径和包含 chrome.exe 的文件夹的路径来设置它,但结果相同。
我执行了flutter doctor -v:
[X] Chrome - develop for the web (Cannot find chrome executable at "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
! "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" is not executable.
我认为问题可能出在带有空格的路径中,但在 CHROME_EXECUTABLE 中设置不同的路径并不能解决问题。
[X] Chrome - develop for the web (Cannot find chrome executable at "D:\Portable\Chromium\chrome-win\chrome.exe")
! "D:\Portable\Chromium\chrome-win\chrome.exe" is not executable.
有人知道吗?
【问题讨论】:
-
我假设您在 Windows 10 上运行。您可以尝试在运行此应用程序的命令提示符下运行
refreshenv并进行测试。我假设您的路径中只有一个颤振安装。也可以尝试以管理员身份运行 IDE 或命令提示符。 -
@AbhilashChandran 我在命令提示符下尝试了
refreshenv并尝试以管理员身份运行shell,但结果相同:! "D:\Portable\Chromium\chrome-win\chrome.exe" is not executable.当我执行D:\Portable\Chromium\chrome-win\chrome.exe时,它会执行chrome。 -
您可以尝试将路径设置为直到
D:\Portable\Chromium\chrome-win没有chrome.exe。不确定这是否会有所帮助。还要确保这个路径字符串周围没有" "。 -
我确定您必须重新启动 IDE,但只是为了确定.. :D 有时在 android studio 中您需要使缓存无效并重新启动。请务必发布
flutter doctor的完整报告,然后颤振维护者可以快速指出它是否是一个已知问题.. -
@AbhilashChandran 问题出在路径字符串周围的
" ",谢谢!现在它起作用了。我建议您写此评论作为标记为问题已解决的答案。
标签: flutter-web