当我下载 Git 时,启动 VS Code 时出现此错误:
The Flutter Daemon failed to start.
在安装git之前,整个项目都在运行。我可以选择我想要运行项目的模拟器等。安装 git 后(PATH 变量有 git 的路径)vs code 给出错误:
PS C:\flutterProject\tg> flutter doctor Error: Unable to find git in your PATH.
我也不能只启动项目并选择模拟器来运行程序。 通过控制台检查git安装情况:
没有设备模拟器:
如果我再次卸载 git 并重新启动 vs code,一切都会正常。
当您查看日志时,它会显示以下内容:
[2:38:08 PM] [General] [Info] Searching for SDKs...
[2:38:08 PM] [General] [Info] Environment PATH:
[2:38:08 PM] [General] [Info] C:\Windows\system32
[2:38:08 PM] [General] [Info] C:\Windows
[2:38:08 PM] [General] [Info] C:\Windows\System32\Wbem
[2:38:08 PM] [General] [Info] C:\Windows\System32\WindowsPowerShell\v1.0\
[2:38:08 PM] [General] [Info] C:\Windows\System32\OpenSSH\
[2:38:08 PM] [General] [Info] C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
[2:38:08 PM] [General] [Info] C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
[2:38:08 PM] [General] [Info] C:\Program Files\dotnet\
[2:38:08 PM] [General] [Info] C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
[2:38:08 PM] [General] [Info] C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
[2:38:08 PM] [General] [Info] C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
[2:38:08 PM] [General] [Info] C:\Program Files\Git\cmd
[2:38:08 PM] [General] [Info] C:\Users\neket\Downloads\openjdk-11.0.0.2_windows-x64\jdk-11.0.0.2\bin
[2:38:08 PM] [General] [Info] C:\Program Files\Git\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Python\Launcher\
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Microsoft\WindowsApps
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Microsoft VS Code\bin
[2:38:08 PM] [General] [Info] C:\flutter\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Python\Python312\Scripts
[2:38:08 PM] [General] [Info] C:\Users\neket\Downloads\apache-maven-3.9.9-bin\apache-maven-3.9.9\bin
[2:38:08 PM] [General] [Info] Took 114ms to search for projects (5 levels)
[2:38:08 PM] [General] [Info] Took 2ms to filter out excluded projects (0 exclusion rules)
[2:38:08 PM] [General] [Info] Found Flutter project at C:\flutterProject\tg:
Mobile? true
Web? false
Create Trigger? false
Flutter Repo? false
[2:38:08 PM] [General] [Info] Searching for flutter.bat
[2:38:08 PM] [General] [Info] Looking for flutter.bat in:
[2:38:08 PM] [General] [Info] C:\flutterProject\tg
[2:38:08 PM] [General] [Info] C:\flutterProject\tg -> C:\flutterProject\tg\bin
[2:38:08 PM] [General] [Info] C:\flutter\bin\
[2:38:08 PM] [General] [Info] C:\flutterProject\tg\.flutter
[2:38:08 PM] [General] [Info] C:\flutterProject\tg\.flutter -> C:\flutterProject\tg\.flutter\bin
[2:38:08 PM] [General] [Info] C:\flutterProject\tg\vendor\flutter
[2:38:08 PM] [General] [Info] C:\flutterProject\tg\vendor\flutter -> C:\flutterProject\tg\vendor\flutter\bin
[2:38:08 PM] [General] [Info] C:\Windows\system32
[2:38:08 PM] [General] [Info] C:\Windows\system32 -> C:\Windows\system32\bin
[2:38:08 PM] [General] [Info] C:\Windows
[2:38:08 PM] [General] [Info] C:\Windows -> C:\Windows\bin
[2:38:08 PM] [General] [Info] C:\Windows\System32\Wbem
[2:38:08 PM] [General] [Info] C:\Windows\System32\Wbem -> C:\Windows\System32\Wbem\bin
[2:38:08 PM] [General] [Info] C:\Windows\System32\WindowsPowerShell\v1.0\
[2:38:08 PM] [General] [Info] C:\Windows\System32\WindowsPowerShell\v1.0\ -> C:\Windows\System32\WindowsPowerShell\v1.0\bin
[2:38:08 PM] [General] [Info] C:\Windows\System32\OpenSSH\
[2:38:08 PM] [General] [Info] C:\Windows\System32\OpenSSH\ -> C:\Windows\System32\OpenSSH\bin
[2:38:08 PM] [General] [Info] C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
[2:38:08 PM] [General] [Info] C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR -> C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR\bin
[2:38:08 PM] [General] [Info] C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
[2:38:08 PM] [General] [Info] C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common -> C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\bin
[2:38:08 PM] [General] [Info] C:\Program Files\dotnet\
[2:38:08 PM] [General] [Info] C:\Program Files\dotnet\ -> C:\Program Files\dotnet\bin
[2:38:08 PM] [General] [Info] C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
[2:38:08 PM] [General] [Info] C:\Program Files\Microsoft SQL Server\150\Tools\Binn\ -> C:\Program Files\Microsoft SQL Server\150\Tools\Binn\bin
[2:38:08 PM] [General] [Info] C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
[2:38:08 PM] [General] [Info] C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\ -> C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\bin
[2:38:08 PM] [General] [Info] C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
[2:38:08 PM] [General] [Info] C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\ -> C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\bin
[2:38:08 PM] [General] [Info] C:\Program Files\Git\cmd
[2:38:08 PM] [General] [Info] C:\Program Files\Git\cmd -> C:\Program Files\Git\cmd\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\Downloads\openjdk-11.0.0.2_windows-x64\jdk-11.0.0.2\bin
[2:38:08 PM] [General] [Info] C:\Program Files\Git\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Python\Launcher\
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Python\Launcher\ -> C:\Users\neket\AppData\Local\Programs\Python\Launcher\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Microsoft\WindowsApps
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Microsoft\WindowsApps -> C:\Users\neket\AppData\Local\Microsoft\WindowsApps\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Microsoft VS Code\bin
[2:38:08 PM] [General] [Info] C:\flutter\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Python\Python312\Scripts
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Python\Python312\Scripts -> C:\Users\neket\AppData\Local\Programs\Python\Python312\Scripts\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\Downloads\apache-maven-3.9.9-bin\apache-maven-3.9.9\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\flutter-sdk
[2:38:08 PM] [General] [Info] C:\Users\neket\flutter-sdk -> C:\Users\neket\flutter-sdk\bin
[2:38:08 PM] [General] [Info] /google/flutter
[2:38:08 PM] [General] [Info] /google/flutter -> \google\flutter\bin
[2:38:08 PM] [General] [Info] /opt/flutter
[2:38:08 PM] [General] [Info] /opt/flutter -> \opt\flutter\bin
[2:38:08 PM] [General] [Info] Found at:
[2:38:08 PM] [General] [Info] C:\flutter\bin\
[2:38:08 PM] [General] [Info] C:\flutter\bin
[2:38:08 PM] [General] [Info] Candidate paths to be post-filtered:
[2:38:08 PM] [General] [Info] C:\flutter\bin\ -> C:\flutter
[2:38:08 PM] [General] [Info] C:\flutter\bin -> C:\flutter
[2:38:08 PM] [General] [Info] Found at C:\flutter\bin\ -> C:\flutter
[2:38:08 PM] [General] [Info] Returning SDK path C:\flutter for flutter.bat
[2:38:08 PM] [General] [Info] Searching for dart.exe
[2:38:08 PM] [General] [Info] Looking for dart.exe in:
[2:38:08 PM] [General] [Info] C:\flutter\bin\cache\dart-sdk
[2:38:08 PM] [General] [Info] C:\flutter\bin\cache\dart-sdk -> C:\flutter\bin\cache\dart-sdk\bin
[2:38:08 PM] [General] [Info] C:\Windows\system32
[2:38:08 PM] [General] [Info] C:\Windows\system32 -> C:\Windows\system32\bin
[2:38:08 PM] [General] [Info] C:\Windows
[2:38:08 PM] [General] [Info] C:\Windows -> C:\Windows\bin
[2:38:08 PM] [General] [Info] C:\Windows\System32\Wbem
[2:38:08 PM] [General] [Info] C:\Windows\System32\Wbem -> C:\Windows\System32\Wbem\bin
[2:38:08 PM] [General] [Info] C:\Windows\System32\WindowsPowerShell\v1.0\
[2:38:08 PM] [General] [Info] C:\Windows\System32\WindowsPowerShell\v1.0\ -> C:\Windows\System32\WindowsPowerShell\v1.0\bin
[2:38:08 PM] [General] [Info] C:\Windows\System32\OpenSSH\
[2:38:08 PM] [General] [Info] C:\Windows\System32\OpenSSH\ -> C:\Windows\System32\OpenSSH\bin
[2:38:08 PM] [General] [Info] C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
[2:38:08 PM] [General] [Info] C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR -> C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR\bin
[2:38:08 PM] [General] [Info] C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
[2:38:08 PM] [General] [Info] C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common -> C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\bin
[2:38:08 PM] [General] [Info] C:\Program Files\dotnet\
[2:38:08 PM] [General] [Info] C:\Program Files\dotnet\ -> C:\Program Files\dotnet\bin
[2:38:08 PM] [General] [Info] C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
[2:38:08 PM] [General] [Info] C:\Program Files\Microsoft SQL Server\150\Tools\Binn\ -> C:\Program Files\Microsoft SQL Server\150\Tools\Binn\bin
[2:38:08 PM] [General] [Info] C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
[2:38:08 PM] [General] [Info] C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\ -> C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\bin
[2:38:08 PM] [General] [Info] C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\
[2:38:08 PM] [General] [Info] C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\ -> C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit\bin
[2:38:08 PM] [General] [Info] C:\Program Files\Git\cmd
[2:38:08 PM] [General] [Info] C:\Program Files\Git\cmd -> C:\Program Files\Git\cmd\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\Downloads\openjdk-11.0.0.2_windows-x64\jdk-11.0.0.2\bin
[2:38:08 PM] [General] [Info] C:\Program Files\Git\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Python\Launcher\
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Python\Launcher\ -> C:\Users\neket\AppData\Local\Programs\Python\Launcher\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Microsoft\WindowsApps
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Microsoft\WindowsApps -> C:\Users\neket\AppData\Local\Microsoft\WindowsApps\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Microsoft VS Code\bin
[2:38:08 PM] [General] [Info] C:\flutter\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Python\Python312\Scripts
[2:38:08 PM] [General] [Info] C:\Users\neket\AppData\Local\Programs\Python\Python312\Scripts -> C:\Users\neket\AppData\Local\Programs\Python\Python312\Scripts\bin
[2:38:08 PM] [General] [Info] C:\Users\neket\Downloads\apache-maven-3.9.9-bin\apache-maven-3.9.9\bin
[2:38:08 PM] [General] [Info] C:\flutter\bin\cache\dart-sdk
[2:38:08 PM] [General] [Info] C:\flutter\bin\cache\dart-sdk -> C:\flutter\bin\cache\dart-sdk\bin
[2:38:08 PM] [General] [Info] Found at:
[2:38:08 PM] [General] [Info] C:\flutter\bin\cache\dart-sdk -> C:\flutter\bin\cache\dart-sdk\bin
[2:38:08 PM] [General] [Info] C:\flutter\bin\cache\dart-sdk -> C:\flutter\bin\cache\dart-sdk\bin
[2:38:08 PM] [General] [Info] Candidate paths to be post-filtered:
[2:38:08 PM] [General] [Info] C:\flutter\bin\cache\dart-sdk
[2:38:08 PM] [General] [Info] C:\flutter\bin\cache\dart-sdk
[2:38:08 PM] [General] [Info] Found at C:\flutter\bin\cache\dart-sdk
[2:38:08 PM] [General] [Info] Returning SDK path C:\flutter\bin\cache\dart-sdk for dart.exe
[2:38:08 PM] [General] [Info] Experiment random number is 63 for experiment 'sdkDaps'. Experiment is enabled for <= 100
[2:38:08 PM] [General] [Info] Experiment 'sdkDaps' is activating (not first time)
[2:38:08 PM] [General] [Info] Experiment random number is 63 for experiment 'sdkDaps'. Experiment is enabled for <= 100
[2:38:08 PM] [General] [Info] Experiment 'sdkDaps' is activating (not first time)
[2:38:08 PM] [General] [Info] Experiment random number is 63 for experiment 'sdkDaps'. Experiment is enabled for <= 10
[2:38:08 PM] [General] [Info] Experiment 'sdkDaps' does not apply and will not be activated
[2:38:08 PM] [General] [Info] !! ⚠️ PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING ⚠️ !!
Dart Code extension: 3.96.0
Flutter extension: 3.96.0 (not activated)
App: Visual Studio Code
App Host: desktop
Version: win 1.93.0
Workspace type: Flutter (LSP)
Workspace name: tg
Dart (3.5.1): C:\flutter\bin\cache\dart-sdk
Flutter (3.24.1): C:\flutter (No device)
[2:38:08 PM] [FlutterDaemon] [Info] Spawning C:\flutter\bin\flutter.bat with args ["daemon"]
[2:38:08 PM] [FlutterDaemon] [Info] .. in C:\flutter
[2:38:08 PM] [FlutterDaemon] [Info] .. with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"C:\\flutter"}}
[2:38:08 PM] [FlutterDaemon] [Info] PID: 2684
[2:38:08 PM] [General] [Info] Returning cached results for project search
[2:38:08 PM] [DartToolingDaemon] [Info] Spawning C:\flutter\bin\cache\dart-sdk\bin\dart.exe with args ["tooling-daemon","--machine"]
[2:38:08 PM] [DartToolingDaemon] [Info] .. with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"C:\\flutter"}}
[2:38:08 PM] [DartToolingDaemon] [Info] PID: 2684
[2:38:08 PM] [General] [Info] Checking 1 projects for supported platforms
[2:38:08 PM] [Analyzer] [Info] Spawning C:\flutter\bin\cache\dart-sdk\bin\dart.exe with args ["language-server","--protocol=lsp","--client-id=VS-Code","--client-version=3.96.0"]
[2:38:08 PM] [Analyzer] [Info] PID: 18720
[2:38:08 PM] [General] [Info] Returning cached results for project search
[2:38:08 PM] [General] [Info] Activating Flutter extension for Flutter project...
[2:38:08 PM] [General] [Info] Version last used for Pub is 3.5.1 (3.5.0), current is 3.5.1 (3.5.0)
[2:38:08 PM] [General] [Info] Found pub status for 0 folders:
[2:38:08 PM] [Analyzer] [Info] ==> Content-Length: 6543
[2:38:08 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":2684,"clientInfo":{"name":"Visual Studio Code","version":"1.93.0"},"locale":"en","rootPath":"c:\\flutterProject\\tg","rootUri":"file:///C%3A/flutterProject/tg","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"configurat…
[2:38:08 PM] [General] [Info] Loaded 20000 package names from vscode-userdata:/c%3A/Users/neket/AppData/Roaming/Code/User/globalStorage/dart-code.dart-code/package_cache.json
[2:38:08 PM] [FlutterDaemon] [Info] <== Error: Unable to find git in your PATH.
重新安装了git。手动添加和删除 Git PATH
在 Windows 命令提示符中运行此命令
git config --global --add safe.directory *
这将自动调整 git 所需的所有内容。 然后运行命令
flutter doctor