在Flutter SDK中找不到Dart

rkue9o1l  于 2023-05-20  发布在  Flutter
关注(0)|答案(5)|浏览(276)

我开发Flutter应用已经有一段时间了。自从上次更新后,我收到了这条消息:
在Flutter SDK中找不到Dart。请在终端运行“Flutter医生”,然后重新加载项目,一旦所有问题得到解决。
我现在无法在vs代码中运行我的应用程序。当我在终端中运行flutter doctor时,一切似乎都很好。

[00:26:17] [General] [Info] Searching for SDKs...
[00:26:17] [General] [Info] Environment PATH:
[00:26:17] [General] [Info]     C:\ProgramData\Oracle\Java\javapath
[00:26:17] [General] [Info]     C:\Program Files (x86)\Intel\iCLS Client\
[00:26:17] [General] [Info]     C:\Program Files\Intel\iCLS Client\
[00:26:17] [General] [Info]     C:\Windows\system32
[00:26:17] [General] [Info]     C:\Windows
[00:26:17] [General] [Info]     C:\Windows\System32\Wbem
[00:26:17] [General] [Info]     C:\Windows\System32\WindowsPowerShell\v1.0\
[00:26:17] [General] [Info]     C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
[00:26:17] [General] [Info]     C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
[00:26:17] [General] [Info]     C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
[00:26:17] [General] [Info]     C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
[00:26:17] [General] [Info]     C:\Program Files\Intel\WiFi\bin\
[00:26:17] [General] [Info]     C:\Program Files\Common Files\Intel\WirelessCommon\
[00:26:17] [General] [Info]     C:\Program Files\Microsoft\Web Platform Installer\
[00:26:17] [General] [Info]     c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\
[00:26:17] [General] [Info]     c:\Program Files\Microsoft SQL Server\100\Tools\Binn\
[00:26:17] [General] [Info]     c:\Program Files\Microsoft SQL Server\100\DTS\Binn\
[00:26:17] [General] [Info]     C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
[00:26:17] [General] [Info]     C:\MinGW\bin
[00:26:17] [General] [Info]     C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\
[00:26:17] [General] [Info]     C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\
[00:26:17] [General] [Info]     C:\Program Files\Microsoft SQL Server\140\Tools\Binn\
[00:26:17] [General] [Info]     C:\Program Files\Microsoft SQL Server\140\DTS\Binn\
[00:26:17] [General] [Info]     C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\
[00:26:17] [General] [Info]     C:\Program Files\Git\cmd
[00:26:17] [General] [Info]     C:\src\flutter\bin
[00:26:17] [General] [Info]     C:\Users\yugiyuu\AppData\Local\Android\tools
[00:26:17] [General] [Info]     C:\Users\yugiyuu\AppData\Local\Androidplatform-tools
[00:26:17] [General] [Info]     C:\Users\yugiyuu\AppData\Local\Programs\Microsoft VS Code\bin
[00:26:17] [General] [Info] Found Flutter project at C:\Users\yugiyuu\Desktop\FindMeReal\FindMeReal:
            Mobile? true
            Web? false
            Create Trigger? false
            Flutter Repo? false
[00:26:17] [General] [Info] Searching for flutter.bat
[00:26:17] [General] [Info]     Looking for flutter.bat in:
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin
[00:26:17] [General] [Info]         C:\Users\yugiyuu\Desktop\FindMeReal\FindMeReal
[00:26:17] [General] [Info]         C:\Users\yugiyuu\Desktop\FindMeReal\FindMeReal\bin
[00:26:17] [General] [Info]         C:\src\flutter\bin\
[00:26:17] [General] [Info]         C:\Users\yugiyuu\Desktop\FindMeReal\FindMeReal\.flutter
[00:26:17] [General] [Info]         C:\Users\yugiyuu\Desktop\FindMeReal\FindMeReal\.flutter\bin
[00:26:17] [General] [Info]         C:\Users\yugiyuu\Desktop\FindMeReal\FindMeReal\vendor\flutter
[00:26:17] [General] [Info]         C:\Users\yugiyuu\Desktop\FindMeReal\FindMeReal\vendor\flutter\bin
[00:26:17] [General] [Info]         C:\ProgramData\Oracle\Java\javapath
[00:26:17] [General] [Info]         C:\ProgramData\Oracle\Java\javapath\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\iCLS Client\
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\iCLS Client\bin
[00:26:17] [General] [Info]         C:\Program Files\Intel\iCLS Client\
[00:26:17] [General] [Info]         C:\Program Files\Intel\iCLS Client\bin
[00:26:17] [General] [Info]         C:\Windows\system32
[00:26:17] [General] [Info]         C:\Windows\system32\bin
[00:26:17] [General] [Info]         C:\Windows
[00:26:17] [General] [Info]         C:\Windows\bin
[00:26:17] [General] [Info]         C:\Windows\System32\Wbem
[00:26:17] [General] [Info]         C:\Windows\System32\Wbem\bin
[00:26:17] [General] [Info]         C:\Windows\System32\WindowsPowerShell\v1.0\
[00:26:17] [General] [Info]         C:\Windows\System32\WindowsPowerShell\v1.0\bin
[00:26:17] [General] [Info]         C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
[00:26:17] [General] [Info]         C:\Program Files\Intel\Intel(R) Management Engine Components\DAL\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL\bin
[00:26:17] [General] [Info]         C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
[00:26:17] [General] [Info]         C:\Program Files\Intel\Intel(R) Management Engine Components\IPT\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT\bin
[00:26:17] [General] [Info]         C:\Program Files\Intel\WiFi\bin\
[00:26:17] [General] [Info]         C:\Program Files\Common Files\Intel\WirelessCommon\
[00:26:17] [General] [Info]         C:\Program Files\Common Files\Intel\WirelessCommon\bin
[00:26:17] [General] [Info]         C:\Program Files\Microsoft\Web Platform Installer\
[00:26:17] [General] [Info]         C:\Program Files\Microsoft\Web Platform Installer\bin
[00:26:17] [General] [Info]         c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\
[00:26:17] [General] [Info]         c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\bin
[00:26:17] [General] [Info]         c:\Program Files\Microsoft SQL Server\100\Tools\Binn\
[00:26:17] [General] [Info]         c:\Program Files\Microsoft SQL Server\100\Tools\Binn\bin
[00:26:17] [General] [Info]         c:\Program Files\Microsoft SQL Server\100\DTS\Binn\
[00:26:17] [General] [Info]         c:\Program Files\Microsoft SQL Server\100\DTS\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
[00:26:17] [General] [Info]         C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\bin
[00:26:17] [General] [Info]         C:\MinGW\bin
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\
[00:26:17] [General] [Info]         C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\140\Tools\Binn\
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\140\Tools\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\140\DTS\Binn\
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\140\DTS\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\
[00:26:17] [General] [Info]         C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files\Git\cmd
[00:26:17] [General] [Info]         C:\Program Files\Git\cmd\bin
[00:26:17] [General] [Info]         C:\src\flutter\bin
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Local\Android\tools
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Local\Android\tools\bin
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Local\Androidplatform-tools
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Local\Androidplatform-tools\bin
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Local\Programs\Microsoft VS Code\bin
[00:26:17] [General] [Info]     Found at:
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin
[00:26:17] [General] [Info]         C:\src\flutter\bin\
[00:26:17] [General] [Info]         C:\src\flutter\bin
[00:26:17] [General] [Info]     Candidate paths to be post-filtered:
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter
[00:26:17] [General] [Info]         C:\src\flutter
[00:26:17] [General] [Info]         C:\src\flutter
[00:26:17] [General] [Info]     Found at C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter
[00:26:17] [General] [Info]     Returning SDK path C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter for flutter.bat
[00:26:17] [General] [Info] Searching for dart.exe
[00:26:17] [General] [Info]     Looking for dart.exe in:
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin\cache\dart-sdk
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin\cache\dart-sdk\bin
[00:26:17] [General] [Info]         C:\ProgramData\Oracle\Java\javapath
[00:26:17] [General] [Info]         C:\ProgramData\Oracle\Java\javapath\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\iCLS Client\
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\iCLS Client\bin
[00:26:17] [General] [Info]         C:\Program Files\Intel\iCLS Client\
[00:26:17] [General] [Info]         C:\Program Files\Intel\iCLS Client\bin
[00:26:17] [General] [Info]         C:\Windows\system32
[00:26:17] [General] [Info]         C:\Windows\system32\bin
[00:26:17] [General] [Info]         C:\Windows
[00:26:17] [General] [Info]         C:\Windows\bin
[00:26:17] [General] [Info]         C:\Windows\System32\Wbem
[00:26:17] [General] [Info]         C:\Windows\System32\Wbem\bin
[00:26:17] [General] [Info]         C:\Windows\System32\WindowsPowerShell\v1.0\
[00:26:17] [General] [Info]         C:\Windows\System32\WindowsPowerShell\v1.0\bin
[00:26:17] [General] [Info]         C:\Program Files\Intel\Intel(R) Management Engine Components\DAL
[00:26:17] [General] [Info]         C:\Program Files\Intel\Intel(R) Management Engine Components\DAL\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL\bin
[00:26:17] [General] [Info]         C:\Program Files\Intel\Intel(R) Management Engine Components\IPT
[00:26:17] [General] [Info]         C:\Program Files\Intel\Intel(R) Management Engine Components\IPT\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT
[00:26:17] [General] [Info]         C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT\bin
[00:26:17] [General] [Info]         C:\Program Files\Intel\WiFi\bin\
[00:26:17] [General] [Info]         C:\Program Files\Common Files\Intel\WirelessCommon\
[00:26:17] [General] [Info]         C:\Program Files\Common Files\Intel\WirelessCommon\bin
[00:26:17] [General] [Info]         C:\Program Files\Microsoft\Web Platform Installer\
[00:26:17] [General] [Info]         C:\Program Files\Microsoft\Web Platform Installer\bin
[00:26:17] [General] [Info]         c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\
[00:26:17] [General] [Info]         c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\bin
[00:26:17] [General] [Info]         c:\Program Files\Microsoft SQL Server\100\Tools\Binn\
[00:26:17] [General] [Info]         c:\Program Files\Microsoft SQL Server\100\Tools\Binn\bin
[00:26:17] [General] [Info]         c:\Program Files\Microsoft SQL Server\100\DTS\Binn\
[00:26:17] [General] [Info]         c:\Program Files\Microsoft SQL Server\100\DTS\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
[00:26:17] [General] [Info]         C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\bin
[00:26:17] [General] [Info]         C:\MinGW\bin
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\
[00:26:17] [General] [Info]         C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\140\Tools\Binn\
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\140\Tools\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\140\DTS\Binn\
[00:26:17] [General] [Info]         C:\Program Files\Microsoft SQL Server\140\DTS\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\
[00:26:17] [General] [Info]         C:\Program Files (x86)\Microsoft SQL Server\150\DTS\Binn\bin
[00:26:17] [General] [Info]         C:\Program Files\Git\cmd
[00:26:17] [General] [Info]         C:\Program Files\Git\cmd\bin
[00:26:17] [General] [Info]         C:\src\flutter\bin
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Local\Android\tools
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Local\Android\tools\bin
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Local\Androidplatform-tools
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Local\Androidplatform-tools\bin
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Local\Programs\Microsoft VS Code\bin
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin\cache\dart-sdk
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin\cache\dart-sdk\bin
[00:26:17] [General] [Info]     Found at:
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin\cache\dart-sdk\bin
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin\cache\dart-sdk\bin
[00:26:17] [General] [Info]     Candidate paths to be post-filtered:
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin\cache\dart-sdk
[00:26:17] [General] [Info]         C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin\cache\dart-sdk
[00:26:17] [General] [Info]     Returning SDK path undefined for dart.exe

这是我的日志。

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, v1.17.0, on Microsoft Windows [Version 6.3.9600], locale tr-TR)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[√] Android Studio (version 3.6)
[√] VS Code (version 1.45.0)
[√] Connected device (1 available)

• No issues found!

这是我的flutter doctor输出。
Dart版本:

我该如何解决这个问题?

zu0ti5jz

zu0ti5jz1#

解决方案对我起作用了。
转到你的flutter sdk所在的目录。然后导航到C:/flutterSDKDir/bin/cache/dart-sdk/bin
复制url
创建新的系统变量路径并粘贴url。会成功的

egdjgwm8

egdjgwm82#

我解决了这个问题,删除Flutter文件夹,并再次下载

inkz8wg9

inkz8wg93#

看起来你可能有两个Flutter SDK的副本:

  • C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter
  • C:\src\flutter

VS Code选择了第一个(可能你在dart.flutterSdkPath中有这个设置?)我的猜测是,当你从终端运行“Flutter医生”时,你运行的是第二个。
如果您从终端运行“C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin\flutter.bat doctor”,它可能会下载Dart SDK并修复问题,但最好消除SDK的一个副本以避免混淆。

编辑:实际上,看起来你的Dart SDK可能不完整,因为dart.exe似乎已经找到,但文件夹正在被过滤掉-我怀疑是因为它没有analysis_server快照。尝试从Flutter SDK中删除“bin/cache/dart-sdk”文件夹,然后运行“C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\flutter\bin\flutter.bat doctor”(如果您想使用另一个SDK,则删除该SDK副本)。

如果仍然不起作用,请在https://github.com/Dart-Code/Dart-Code上提出问题,我们可以解决它(也许可以改进报告)。

4c8rllxm

4c8rllxm4#

C:\src\flutter\bin在环境变量的路径(用户变量)中添加此类型的URL。

kqlmhetl

kqlmhetl5#

按照以下步骤操作。
1.转到flutter sdk所在的目录。
1.导航到C:\flutter_windows_3.10.1-stable\flutter\bin\cache\dart-sdk\bin
1.复制路径C:\flutter_windows_3.10.1-stable\flutter\bin\cache\dart-sdk\bin并将其粘贴到环境变量的顶部。

相关问题