在 Flutter SDK 中找不到 Dart
Posted
技术标签:
【中文标题】在 Flutter SDK 中找不到 Dart【英文标题】:Could not find Dart in your Flutter SDK 【发布时间】:2020-08-27 15:00:48 【问题描述】:我一直在开发 Flutter 应用程序。自上次更新以来,我收到此消息:
在您的 Flutter SDK 中找不到 Dart。请运行“颤振医生” 在终端中,然后在解决所有问题后重新加载项目。
我现在无法在 vs-code 中运行我的应用程序。当我在终端运行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 --version
时你的输出是什么?
" 'dart' 未被识别为内部或外部命令、可运行程序或批处理文件。"
你必须安装dart SDK
。
我发布了一个答案。看看吧。
@T.TSage 您确定dart
需要在全球范围内可用吗?我认为将它本地安装在flutter文件夹中就足够了。
【参考方案1】:
我通过删除flutter文件夹并重新下载解决了这个问题
【讨论】:
【参考方案2】:解决方案对我有用。
转到您的颤振 sdk 所在的目录。 并导航到 C:/flutterSDKDir/bin/cache/dart-sdk/bin
复制网址
创建新的系统变量路径并粘贴它们的 url。 它会起作用的。
【讨论】:
【参考方案3】:看起来你可能有两个 Flutter SDK 副本:
C:\Users\yugiyuu\AppData\Roaming\Microsoft\Windows\开始菜单\程序\flutter C:\src\flutterVS Code 正在选择第一个(可能你在dart.flutterSdkPath
中设置了那个?)。我的猜测是,当您从终端运行“颤振医生”时,您正在运行第二个。
如果你从终端运行“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 副本,请删除该副本)。
如果仍然无法解决问题,请在https://github.com/Dart-Code/Dart-Code 提出问题,我们可以解决问题(或许还可以改进报告)。
【讨论】:
以上是关于在 Flutter SDK 中找不到 Dart的主要内容,如果未能解决你的问题,请参考以下文章
如何解决“在 Flutter SDK 中找不到包 integration_test”错误
在 Visual Studio Code 中找不到 Flutter Inspector / Toggle Debug Paint
错误:在颤振中找不到类型“ui.TextHeightBehavior”