我启动vs code,得到错误flutter daemon failed to start。我打开日志,错误是git在path中找不到,即使我已经将git添加到path中。这是日志
[6:54:12 PM] [FlutterDaemon] [Info] Spawning C:\flutter\bin\flutter.bat with args ["daemon"]
[6:54:12 PM] [FlutterDaemon] [Info] .. in C:\flutter
[6:54:12 PM] [FlutterDaemon] [Info] .. with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"C:\\flutter"}}
[6:54:12 PM] [FlutterDaemon] [Info] PID: 14948
[6:54:12 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.74.0"]
[6:54:12 PM] [Analyzer] [Info] PID: 21988
[6:54:12 PM] [General] [Info] Returning cached results for project search
[6:54:12 PM] [General] [Info] Activating Flutter extension for Flutter project...
[6:54:12 PM] [DevTools] [Info] Spawning C:\flutter\bin\cache\dart-sdk\bin\dart.exe with args ["devtools","--machine","--try-ports","10","--allow-embedding"]
[6:54:12 PM] [DevTools] [Info] .. with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code","FLUTTER_ROOT":"C:\\flutter"}}
[6:54:12 PM] [DevTools] [Info] PID: 14948
[6:54:12 PM] [General] [Info] Version last used for Pub is 3.1.5 (3.1.0), current is 3.1.5 (3.1.0)
[6:54:12 PM] [General] [Info] Found 0 folders requiring "pub get" or "pub upgrade":
[6:54:12 PM] [Analyzer] [Info] ==> Content-Length: 6429
[6:54:12 PM] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":14948,"clientInfo":{"name":"Visual Studio Code","version":"1.83.1"},"locale":"en","rootPath":"c:\\Windows\\System32\\learningdart","rootUri":"file:///C%3A/Windows/System32/learningdart","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsO…
[6:54:12 PM] [General] [Info] Loaded 20000 package names from vscode-userdata:/c%3A/Users/preda/AppData/Roaming/Code/User/globalStorage/dart-code.dart-code/package_cache.json
[6:54:12 PM] [FlutterDaemon] [Info] <== Error: Unable to find git in your PATH.
字符串
2条答案
按热度按时间cclgggtu1#
确保Git的bin目录包含在系统的PATH环境变量中。
使用以下步骤更新git路径:
适用于Windows:
C:\Program Files\Git\bin
)的路径。如果没有,添加它。对于macOS和Linux:
.bashrc
或.profile
)。/usr/local/git/bin
)的路径是否包含在PATH变量中。如果没有,添加它,然后保存文件。wlzqhblo2#
我重新安装了git并从cmd启动了flutter项目,它工作了,但现在当我尝试运行时,我得到了这个错误:
字符串
我设法找到导致错误的xml文件,但我不知道该怎么办。任何人都可以帮助?