我每次在Windows 11上打开VSCode时都收到此错误
Flutter守护程序无法启动。
沿着还有一个通知,告诉我软件包丢失或过期。我在打开Andriod Studio时还收到一个错误,指出:
Flutter设备守护进程#1退出(退出代码255),标准错误:此时正在检查Dart SDK版本...意外。
这只是今天开始的,在这之前的几个星期里一切都运行得很完美。
在Powershell中使用flutter run
可以在模拟器和物理设备上运行应用程序,没有任何问题,问题似乎与VSCode和/或Android Studio有关。
我已经尝试了我能在这里和其他地方找到的每一个修复,包括:
1.在一个新的目录中重新安装完整的Flutter,在一个新的驱动器中更改PATH变量
1.删除我的.gradle文件夹,然后再完全删除并重新安装
1.运行flutter doctor -v
,返回一组完整的绿色检查
1.运行flutter clean
和flutter upgrade
VSCode为我提供了以下加载日志:
[17:46:27] [General] [Info] Environment PATH:
[17:46:27] [General] [Info] C:\Windows\system32
[17:46:27] [General] [Info] C:\Windows
[17:46:27] [General] [Info] C:\Windows\System32\Wbem
[17:46:27] [General] [Info] C:\Windows\System32\WindowsPowerShell\v1.0\
[17:46:27] [General] [Info] C:\Windows\System32\OpenSSH\
[17:46:27] [General] [Info] C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
[17:46:27] [General] [Info] C:\Program Files\dotnet\
[17:46:27] [General] [Info] D:\Program Files\Git\cmd
[17:46:27] [General] [Info] C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
[17:46:27] [General] [Info] D:\Program Files\PuTTY\
[17:46:27] [General] [Info] D:\Program Files\nodejs\
[17:46:27] [General] [Info] C:\WINDOWS\system32
[17:46:27] [General] [Info] C:\WINDOWS
[17:46:27] [General] [Info] C:\WINDOWS\System32\Wbem
[17:46:27] [General] [Info] C:\WINDOWS\System32\WindowsPowerShell\v1.0\
[17:46:27] [General] [Info] C:\WINDOWS\System32\OpenSSH\
[17:46:27] [General] [Info] C:\ProgramData\chocolatey\bin
[17:46:27] [General] [Info] C:\Program Files (x86)\dotnet\
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Microsoft\WindowsApps
[17:46:27] [General] [Info] D:\Program Files\JetBrains\IntelliJ IDEA 2021.2.3\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\atom\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\nvs\
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\GitHubDesktop\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Roaming\npm
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Microsoft\WindowsApps
[17:46:27] [General] [Info] C:\Program Files\heroku\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Roaming\Pub\Cache\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Programs\Microsoft VS Code\bin
[17:46:27] [General] [Info] D:\src\flutter\bin
[17:46:27] [General] [Info] Took 306ms to search for projects (5 levels)
[17:46:27] [General] [Info] Took 3ms to filter out excluded projects (0 exclusion rules)
[17:46:27] [General] [Info] Found Flutter project at E:\Flutter\test_app:
Mobile? true
Web? false
Create Trigger? false
Flutter Repo? false
[17:46:27] [General] [Info] Searching for flutter.bat
[17:46:27] [General] [Info] Looking for flutter.bat in:
[17:46:27] [General] [Info] C:\tools\flutter
[17:46:27] [General] [Info] C:\tools\flutter\bin
[17:46:27] [General] [Info] E:\Flutter\test_app
[17:46:27] [General] [Info] E:\Flutter\test_app\bin
[17:46:27] [General] [Info] C:\src\flutter\bin\
[17:46:27] [General] [Info] E:\Flutter\test_app\.flutter
[17:46:27] [General] [Info] E:\Flutter\test_app\.flutter\bin
[17:46:27] [General] [Info] E:\Flutter\test_app\vendor\flutter
[17:46:27] [General] [Info] E:\Flutter\test_app\vendor\flutter\bin
[17:46:27] [General] [Info] C:\Users\pault\flutter-sdk
[17:46:27] [General] [Info] C:\Users\pault\flutter-sdk\bin
[17:46:27] [General] [Info] /google/flutter
[17:46:27] [General] [Info] \google\flutter\bin
[17:46:27] [General] [Info] C:\Windows\system32
[17:46:27] [General] [Info] C:\Windows\system32\bin
[17:46:27] [General] [Info] C:\Windows
[17:46:27] [General] [Info] C:\Windows\bin
[17:46:27] [General] [Info] C:\Windows\System32\Wbem
[17:46:27] [General] [Info] C:\Windows\System32\Wbem\bin
[17:46:27] [General] [Info] C:\Windows\System32\WindowsPowerShell\v1.0\
[17:46:27] [General] [Info] C:\Windows\System32\WindowsPowerShell\v1.0\bin
[17:46:27] [General] [Info] C:\Windows\System32\OpenSSH\
[17:46:27] [General] [Info] C:\Windows\System32\OpenSSH\bin
[17:46:27] [General] [Info] C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
[17:46:27] [General] [Info] C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\bin
[17:46:27] [General] [Info] C:\Program Files\dotnet\
[17:46:27] [General] [Info] C:\Program Files\dotnet\bin
[17:46:27] [General] [Info] D:\Program Files\Git\cmd
[17:46:27] [General] [Info] D:\Program Files\Git\cmd\bin
[17:46:27] [General] [Info] C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
[17:46:27] [General] [Info] C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR\bin
[17:46:27] [General] [Info] D:\Program Files\PuTTY\
[17:46:27] [General] [Info] D:\Program Files\PuTTY\bin
[17:46:27] [General] [Info] D:\Program Files\nodejs\
[17:46:27] [General] [Info] D:\Program Files\nodejs\bin
[17:46:27] [General] [Info] C:\WINDOWS\system32
[17:46:27] [General] [Info] C:\WINDOWS\system32\bin
[17:46:27] [General] [Info] C:\WINDOWS
[17:46:27] [General] [Info] C:\WINDOWS\bin
[17:46:27] [General] [Info] C:\WINDOWS\System32\Wbem
[17:46:27] [General] [Info] C:\WINDOWS\System32\Wbem\bin
[17:46:27] [General] [Info] C:\WINDOWS\System32\WindowsPowerShell\v1.0\
[17:46:27] [General] [Info] C:\WINDOWS\System32\WindowsPowerShell\v1.0\bin
[17:46:27] [General] [Info] C:\WINDOWS\System32\OpenSSH\
[17:46:27] [General] [Info] C:\WINDOWS\System32\OpenSSH\bin
[17:46:27] [General] [Info] C:\ProgramData\chocolatey\bin
[17:46:27] [General] [Info] C:\Program Files (x86)\dotnet\
[17:46:27] [General] [Info] C:\Program Files (x86)\dotnet\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Microsoft\WindowsApps
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Microsoft\WindowsApps\bin
[17:46:27] [General] [Info] D:\Program Files\JetBrains\IntelliJ IDEA 2021.2.3\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\atom\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\nvs\
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\nvs\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\GitHubDesktop\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Roaming\npm
[17:46:27] [General] [Info] C:\Users\pault\AppData\Roaming\npm\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Microsoft\WindowsApps
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Microsoft\WindowsApps\bin
[17:46:27] [General] [Info] C:\Program Files\heroku\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Roaming\Pub\Cache\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Programs\Microsoft VS Code\bin
[17:46:27] [General] [Info] D:\src\flutter\bin
[17:46:27] [General] [Info] Found at:
[17:46:27] [General] [Info] C:\tools\flutter\bin
[17:46:27] [General] [Info] D:\src\flutter\bin
[17:46:27] [General] [Info] Candidate paths to be post-filtered:
[17:46:27] [General] [Info] C:\tools\flutter
[17:46:27] [General] [Info] D:\src\flutter
[17:46:27] [General] [Info] Found at C:\tools\flutter
[17:46:27] [General] [Info] Returning SDK path C:\tools\flutter for flutter.bat
[17:46:27] [General] [Info] Searching for dart.exe
[17:46:27] [General] [Info] Looking for dart.exe in:
[17:46:27] [General] [Info] C:\tools\flutter\bin\cache\dart-sdk
[17:46:27] [General] [Info] C:\tools\flutter\bin\cache\dart-sdk\bin
[17:46:27] [General] [Info] C:\Windows\system32
[17:46:27] [General] [Info] C:\Windows\system32\bin
[17:46:27] [General] [Info] C:\Windows
[17:46:27] [General] [Info] C:\Windows\bin
[17:46:27] [General] [Info] C:\Windows\System32\Wbem
[17:46:27] [General] [Info] C:\Windows\System32\Wbem\bin
[17:46:27] [General] [Info] C:\Windows\System32\WindowsPowerShell\v1.0\
[17:46:27] [General] [Info] C:\Windows\System32\WindowsPowerShell\v1.0\bin
[17:46:27] [General] [Info] C:\Windows\System32\OpenSSH\
[17:46:27] [General] [Info] C:\Windows\System32\OpenSSH\bin
[17:46:27] [General] [Info] C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
[17:46:27] [General] [Info] C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common\bin
[17:46:27] [General] [Info] C:\Program Files\dotnet\
[17:46:27] [General] [Info] C:\Program Files\dotnet\bin
[17:46:27] [General] [Info] D:\Program Files\Git\cmd
[17:46:27] [General] [Info] D:\Program Files\Git\cmd\bin
[17:46:27] [General] [Info] C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
[17:46:27] [General] [Info] C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR\bin
[17:46:27] [General] [Info] D:\Program Files\PuTTY\
[17:46:27] [General] [Info] D:\Program Files\PuTTY\bin
[17:46:27] [General] [Info] D:\Program Files\nodejs\
[17:46:27] [General] [Info] D:\Program Files\nodejs\bin
[17:46:27] [General] [Info] C:\WINDOWS\system32
[17:46:27] [General] [Info] C:\WINDOWS\system32\bin
[17:46:27] [General] [Info] C:\WINDOWS
[17:46:27] [General] [Info] C:\WINDOWS\bin
[17:46:27] [General] [Info] C:\WINDOWS\System32\Wbem
[17:46:27] [General] [Info] C:\WINDOWS\System32\Wbem\bin
[17:46:27] [General] [Info] C:\WINDOWS\System32\WindowsPowerShell\v1.0\
[17:46:27] [General] [Info] C:\WINDOWS\System32\WindowsPowerShell\v1.0\bin
[17:46:27] [General] [Info] C:\WINDOWS\System32\OpenSSH\
[17:46:27] [General] [Info] C:\WINDOWS\System32\OpenSSH\bin
[17:46:27] [General] [Info] C:\ProgramData\chocolatey\bin
[17:46:27] [General] [Info] C:\Program Files (x86)\dotnet\
[17:46:27] [General] [Info] C:\Program Files (x86)\dotnet\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Microsoft\WindowsApps
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Microsoft\WindowsApps\bin
[17:46:27] [General] [Info] D:\Program Files\JetBrains\IntelliJ IDEA 2021.2.3\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\atom\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\nvs\
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\nvs\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\GitHubDesktop\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Roaming\npm
[17:46:27] [General] [Info] C:\Users\pault\AppData\Roaming\npm\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Microsoft\WindowsApps
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Microsoft\WindowsApps\bin
[17:46:27] [General] [Info] C:\Program Files\heroku\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Roaming\Pub\Cache\bin
[17:46:27] [General] [Info] C:\Users\pault\AppData\Local\Programs\Microsoft VS Code\bin
[17:46:27] [General] [Info] D:\src\flutter\bin
[17:46:27] [General] [Info] C:\tools\flutter\bin\cache\dart-sdk
[17:46:27] [General] [Info] C:\tools\flutter\bin\cache\dart-sdk\bin
[17:46:27] [General] [Info] Found at:
[17:46:27] [General] [Info] C:\tools\flutter\bin\cache\dart-sdk\bin
[17:46:27] [General] [Info] C:\tools\flutter\bin\cache\dart-sdk\bin
[17:46:27] [General] [Info] Candidate paths to be post-filtered:
[17:46:27] [General] [Info] C:\tools\flutter\bin\cache\dart-sdk
[17:46:27] [General] [Info] C:\tools\flutter\bin\cache\dart-sdk
[17:46:27] [General] [Info] Found at C:\tools\flutter\bin\cache\dart-sdk
[17:46:27] [General] [Info] Returning SDK path C:\tools\flutter\bin\cache\dart-sdk for dart.exe
[17:46:27] [General] [Info] Experiment random number is 98 for experiment 'sdkDaps'. Experiment is enabled for <= 10
[17:46:27] [General] [Info] Experiment 'sdkDaps' does not apply and will not be activated
[17:46:27] [General] [Info] !! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!
Dart Code extension: 3.48.3
Flutter extension: 3.48.0 (not activated)
App: Visual Studio Code
Version: 1.71.0
Platform: win
Workspace type: Flutter
Analyzer type: LSP
Multi-root?: false
Dart SDK:
Loc: C:\tools\flutter\bin\cache\dart-sdk
Ver: 2.16.2
Flutter SDK:
Loc: C:\tools\flutter
Ver: 2.10.5
HTTP_PROXY: undefined
NO_PROXY: undefined
[17:46:27] [FlutterDaemon] [Info] Spawning C:\tools\flutter\bin\flutter.bat with args ["daemon"]
[17:46:27] [FlutterDaemon] [Info] .. in C:\tools\flutter
[17:46:27] [FlutterDaemon] [Info] .. with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
[17:46:28] [FlutterDaemon] [Info] PID: 11176
[17:46:28] [FlutterDaemon] [Info] ==> [{"id":"1","method":"emulator.getEmulators"}]
[17:46:28] [DevTools] [Info] Spawning C:\tools\flutter\bin\cache\dart-sdk\bin\dart.exe with args ["devtools","--machine","--try-ports","10","--allow-embedding"]
[17:46:28] [DevTools] [Info] .. with {"toolEnv":{"FLUTTER_HOST":"VSCode","PUB_ENVIRONMENT":"vscode.dart-code"}}
[17:46:28] [DevTools] [Info] PID: 11176
[17:46:28] [Analyzer] [Info] Spawning C:\tools\flutter\bin\cache\dart-sdk\bin\dart.exe with args ["language-server","--protocol=lsp","--client-id=VS-Code","--client-version=3.48.3"]
[17:46:28] [Analyzer] [Info] PID: 2456
[17:46:28] [General] [Info] Returning cached results for project search
[17:46:28] [General] [Info] Activating Flutter extension for Flutter project...
[17:46:28] [General] [Info] Extension:Startup timing: 401ms
[17:46:28] [General] [Info] Found 1 folders requiring "pub get":
E:\Flutter\test_app
[17:46:28] [Analyzer] [Info] ==> Content-Length: 6247
[17:46:28] [Analyzer] [Info] ==> {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":11176,"clientInfo":{"name":"Visual Studio Code","version":"1.71.0"},"locale":"en-gb","rootPath":"e:\\Flutter\\test_app","rootUri":"file:///e%3A/Flutter/test_app","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"configur…
[17:46:28] [General] [Info] Caching Pub package names from pub.dev...
[17:46:28] [General] [Info] !! PLEASE REVIEW THIS LOG FOR SENSITIVE INFORMATION BEFORE SHARING !!
Dart Code extension: 3.48.3
Flutter extension: 3.48.0 (activated)
App: Visual Studio Code
Version: 1.71.0
Platform: win
Workspace type: Flutter
Analyzer type: LSP
Multi-root?: false
Dart SDK:
Loc: C:\tools\flutter\bin\cache\dart-sdk
Ver: 2.16.2
Flutter SDK:
Loc: C:\tools\flutter
Ver: 2.10.5
HTTP_PROXY: undefined
NO_PROXY: undefined
[17:46:28] [FlutterDaemon] [Error] Checking Dart SDK version...
<< was unexpected at this time.```
2条答案
按热度按时间eivgtgni1#
两个评论建议都没有提供修复,我已经进入了这些问题,并尝试了提供的修复。
我今天又试了一次,最终发现了这个问题。在某个时候,VSCode内部的Dart和Flutter SDK路径损坏了,最终只是转到设置并编辑
settings.json
文件以指向新位置,这已经修复了这个问题。a14dhokn2#
当我运行“flutter doctor”的时候,它给予了我所有的绿色检查。但是vscode给了我“flutter daemon failed to start”错误。我认为这是设置和路径的问题。所以,我建议你重新安装vscode(稳定)并初始化你的vscode设置。我为我工作。
1.删除Vscode和设置(类似于缓存)
1.重新安装Vscode和flutter扩展。(现在包括Dart pkg(2023.1))
1.如果仍然出现此错误,请检查有关tool_state flutter的配置
在我的情况下(M1 MacOS)键入以下代码并工作!“sudo chown -R $(whoami)/用户/{用户名}/.config/flutter/工具状态”