Flutter / VSC 在你的 Flutter SDK 中找不到 Dart
Posted
技术标签:
【中文标题】Flutter / VSC 在你的 Flutter SDK 中找不到 Dart【英文标题】:Flutter / VSC Could not find Dart in your Flutter SDK 【发布时间】:2020-04-06 00:11:02 【问题描述】:我在 Visual Studio 代码中使用 Git 设置了一个颤振项目。 我试图从 Git 中提取,我想我遇到了合并冲突。
现在我收到错误消息“在您的 Flutter SDK 中找不到 Dart。请在终端中运行 'flutter doctor',然后在解决所有问题后重新加载项目”
当运行颤振医生时:
Downloading Dart SDK from Flutter engine <<<<<<< HEAD
b863200c37df4ed378042de11c4e9ff34e4e58c9
=======
2994f7e1e682039464cb25e31a78b86a3c59b695
>>>>>>> 27321ebbad34b0a3fafe99fac037102196d655ff...
curl: (3) URL using bad/illegal format or missing URL
Failed to retrieve the Dart SDK from: https://storage.googleapis.com/flutter_infra/flutter/<<<<<<< HEAD
b863200c37df4ed378042de11c4e9ff34e4e58c9
=======
2994f7e1e682039464cb25e31a78b86a3c59b695
>>>>>>> 27321ebbad34b0a3fafe99fac037102196d655ff/dart-sdk-darwin-x64.zip
If you're located in China, please see this page:
https://flutter.dev/community/china
我该如何解决这个问题? 任何帮助表示赞赏。
Git 状态:
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
运行 git 清理 -xfd git stash save --keep-index git 存储下降 git 拉 扑医生 在 Flutter 目录中
输出:
Juju@Juju-MacBook-Pro flutter % git clean -xfd
Removing .DS_Store
Removing .idea/
Skipping repository .pub-cache/git/goldens-c47f1308188dca65b3899228cac37f252ea8b411
Removing .pub-cache/git/cache
Removing .pub-cache/_temp
Removing .pub-cache/hosted
Removing bin/cache/
Removing dev/automated_tests/pubspec.lock
Removing dev/benchmarks/complex_layout/complex_layout.iml
Removing dev/benchmarks/complex_layout/pubspec.lock
Removing dev/benchmarks/macrobenchmarks/pubspec.lock
Removing dev/benchmarks/microbenchmarks/pubspec.lock
Removing dev/bots/bots.iml
Removing dev/bots/pubspec.lock
Removing dev/customer_testing/pubspec.lock
Removing dev/devicelab/devicelab.iml
Removing dev/devicelab/pubspec.lock
Removing dev/integration_tests/android_semantics_testing/pubspec.lock
Removing dev/integration_tests/android_splash_screens/splash_screen_kitchen_sink/pubspec.lock
Removing dev/integration_tests/android_splash_screens/splash_screen_load_rotate/pubspec.lock
Removing dev/integration_tests/android_splash_screens/splash_screen_trans_rotate/pubspec.lock
Removing dev/integration_tests/android_views/pubspec.lock
Removing dev/integration_tests/channels/pubspec.lock
Removing dev/integration_tests/codegen/pubspec.lock
Removing dev/integration_tests/external_ui/pubspec.lock
Removing dev/integration_tests/flavors/pubspec.lock
Removing dev/integration_tests/image_loading/pubspec.lock
Removing dev/integration_tests/ios_add2app/flutterapp/pubspec.lock
Removing dev/integration_tests/named_isolates/pubspec.lock
Removing dev/integration_tests/platform_interaction/pubspec.lock
Removing dev/integration_tests/release_smoke_test/pubspec.lock
Removing dev/integration_tests/simple_codegen/pubspec.lock
Removing dev/integration_tests/ui/pubspec.lock
Removing dev/integration_tests/web/pubspec.lock
Removing dev/manual_tests/android.iml
Removing dev/manual_tests/manual_tests.iml
Removing dev/manual_tests/pubspec.lock
Removing dev/snippets/pubspec.lock
Removing dev/tools/gen_keycodes/pubspec.lock
Removing dev/tools/pubspec.lock
Removing dev/tools/tools.iml
Removing dev/tools/vitool/pubspec.lock
Removing examples/catalog/catalog.iml
Removing examples/catalog/pubspec.lock
Removing examples/flutter_gallery/android.iml
Removing examples/flutter_gallery/flutter_gallery.iml
Removing examples/flutter_gallery/pubspec.lock
Removing examples/flutter_view/flutter_view.iml
Removing examples/flutter_view/pubspec.lock
Removing examples/hello_world/android.iml
Removing examples/hello_world/hello_world.iml
Removing examples/hello_world/pubspec.lock
Removing examples/image_list/pubspec.lock
Removing examples/layers/layers.iml
Removing examples/layers/pubspec.lock
Removing examples/platform_channel/android.iml
Removing examples/platform_channel/platform_channel.iml
Removing examples/platform_channel/pubspec.lock
Removing examples/platform_channel_swift/platform_channel_swift.iml
Removing examples/platform_channel_swift/pubspec.lock
Removing examples/platform_view/android.iml
Removing examples/platform_view/full_platform_view.iml
Removing examples/platform_view/pubspec.lock
Removing examples/stocks/android.iml
Removing examples/stocks/pubspec.lock
Removing examples/stocks/stocks.iml
Removing flutter_root.iml
Removing packages/flutter/coverage/
Removing packages/flutter/flutter.iml
Removing packages/flutter/pubspec.lock
Removing packages/flutter_driver/flutter_driver.iml
Removing packages/flutter_driver/pubspec.lock
Removing packages/flutter_goldens/pubspec.lock
Removing packages/flutter_goldens_client/pubspec.lock
Removing packages/flutter_localizations/flutter_localizations.iml
Removing packages/flutter_localizations/pubspec.lock
Removing packages/flutter_test/flutter_test.iml
Removing packages/flutter_test/pubspec.lock
Removing packages/flutter_test/test/test_config/project_root/pubspec.lock
Removing packages/flutter_tools/.dart_tool/
Removing packages/flutter_tools/.packages
Removing packages/flutter_tools/flutter_tools.iml
Removing packages/flutter_tools/pubspec.lock
Removing packages/flutter_tools/test/data/asset_test/main/pubspec.lock
Removing packages/fuchsia_remote_debug_protocol/pubspec.lock
Juju@Juju-MacBook-Pro flutter % git stash save --keep-index
bin/internal/engine.version: needs merge
dev/bots/test.dart: needs merge
packages/flutter_tools/lib/src/commands/attach.dart: needs merge
packages/flutter_tools/lib/src/context_runner.dart: needs merge
packages/flutter_tools/lib/src/ios/devices.dart: needs merge
packages/flutter_tools/lib/src/macos/cocoapods.dart: needs merge
packages/flutter_tools/lib/src/mdns_discovery.dart: needs merge
packages/flutter_tools/pubspec.yaml: needs merge
packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart: needs merge
packages/flutter_tools/test/general.shard/ios/devices_test.dart: needs merge
packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart: needs merge
packages/flutter_tools/test/general.shard/mdns_discovery_test.dart: needs merge
bin/internal/engine.version: needs merge
dev/bots/test.dart: needs merge
packages/flutter_tools/lib/src/commands/attach.dart: needs merge
packages/flutter_tools/lib/src/context_runner.dart: needs merge
packages/flutter_tools/lib/src/ios/devices.dart: needs merge
packages/flutter_tools/lib/src/macos/cocoapods.dart: needs merge
packages/flutter_tools/lib/src/mdns_discovery.dart: needs merge
packages/flutter_tools/pubspec.yaml: needs merge
packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart: needs merge
packages/flutter_tools/test/general.shard/ios/devices_test.dart: needs merge
packages/flutter_tools/test/general.shard/macos/cocoapods_test.dart: needs merge
packages/flutter_tools/test/general.shard/mdns_discovery_test.dart: needs merge
bin/internal/engine.version: unmerged (9b47683e091e31759027947b50967b113e5c4a0e)
bin/internal/engine.version: unmerged (446391086d1083a9efd4e552d90c763a1a5b0353)
bin/internal/engine.version: unmerged (cf062e01a0c732cce453bb1c83a15816aaef7ffd)
dev/bots/test.dart: unmerged (c546075ce7839a936a31ae5df42c2797ad288645)
dev/bots/test.dart: unmerged (aef335fd140f9054ac355231dd37a71f6505c9d9)
dev/bots/test.dart: unmerged (ee779205405e32b833e783409a50ab1147dc0e1d)
packages/flutter_tools/lib/src/commands/attach.dart: unmerged (dd68a476a86d24e8ea787970ad4209fd532cc505)
packages/flutter_tools/lib/src/commands/attach.dart: unmerged (20a23a31fa261bcd8ce90a6913b6da8a809875be)
packages/flutter_tools/lib/src/commands/attach.dart: unmerged (5c9e24302d0b51e47b95fefbfd19aa5098d2bca3)
packages/flutter_tools/lib/src/context_runner.dart: unmerged (83985e5fce6f592ecb4cd1ee4e909aa4ce11740b)
...
fatal: git-write-tree: error building trees
Cannot save the current index state
Juju@Jujus-MacBook-Pro flutter % git stash drop
No stash entries found.
Juju@Jujus-MacBook-Pro flutter % git pull
error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
解决方案
git reset head --hard
在颤振目录中及之后
flutter doctor
在项目中为我工作!它自动重新安装了flutter sdk。
【问题讨论】:
【参考方案1】:肯定只是合并冲突,所以不要惊慌。运行 git status 并先发布结果。
【讨论】:
flutter sdk项目中的git状态如何? 你到底是什么意思?这是我在 vsc 中打开我的颤振项目并在终端中输入“git status”的时候。对不起,我是初学者... 由于项目中没有冲突,我怀疑合并冲突发生在flutter sdk文件夹中。 Flutter 安装目录处于不一致的状态,导致各种麻烦。去那里进行一些重置并重新拉动。检查此部分。 github.com/flutter/flutter/wiki/… 嗯。试试git reset head --hard
然后git status
git reset head --hard
in 颤振目录,然后flutter doctor
in 项目为我工作!它自动重新安装了flutter sdk。谢谢【参考方案2】:
我有办法解决
Mac 操作系统
: 转到您的 Flutter bin 文件夹,您首先下载了 Flutter, 然后在 VS Code 中,打开那个 Flutter 项目, 获取所有包裹 然后打开终端, 写
git add .
git commit -m 'problem fixed'
then from the git icon , change branch to main or master
现在你的问题将得到解决。
【讨论】:
以上是关于Flutter / VSC 在你的 Flutter SDK 中找不到 Dart的主要内容,如果未能解决你的问题,请参考以下文章
Flutter 5个必备的桌面插件包将包含在你的下一个版本中