问题描述
最新更新了Flutter SDK到最新版本,然后使用doctor
命令检查环境发现以下警告.
wangyangyangdeMacBook-Pro:fusion_pro wangyang$ flutter doctor -v
[!] Flutter (Channel stable, 3.7.9, on macOS 12.6.5 21G531 darwin-x64, locale zh-Hans-CN)
• Flutter version 3.7.9 on channel stable at /Users/wangyang/Developer/develop_env/flutter_3.7.9
! Warning: `dart` on your path resolves to /usr/local/Cellar/dart/2.13.3/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
/Users/wangyang/Developer/develop_env/flutter_3.7.9. Consider adding /Users/wangyang/Developer/develop_env/flutter_3.7.9/bin to the front of your
path.
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 62bd79521d (5 weeks ago), 2023-03-30 10:59:36 -0700
• Engine revision ec975089ac
• Dart version 2.19.6
• DevTools version 2.20.1
• Pub download mirror https://pub.flutter-io.cn
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and
upgrades.
解决方案
Warning: dart
on your path resolves to /usr/local/Cellar/dart/2.13.3/libexec/bin/dart, which is not inside your current Flutter SDK checkout at
/Users/wangyang/Developer/develop_env/flutter_3.7.9. Consider adding /Users/wangyang/Developer/develop_env/flutter_3.7.9/bin to the front of your
path.
看警告提示是检查到了单独的Dart SDK,不是在Flutter SDK之中,建议我们将Flutter中的Dart路径添加到环境变量中。
说白了就是系统中存在了2个Dart SDK,我们只需要将单独的Dart SDk删除就好。
根据路径Cellar
,我们判断出这是以前使用homebrew
安装的Dart。
我们使用brew list
查看是否安装过.
发现确实安装过, 我们使用brew remove dart
来卸载Dart.
wangyangyangdeMacBook-Pro:~ wangyang$ brew remove dart
Uninstalling /usr/local/Cellar/dart/2.13.3... (508 files, 477MB)
可以看到卸载的路径正好对应了警告中的路径,说明确实是这个Dart引发的警告。文章来源:https://www.toymoban.com/news/detail-667699.html
再次运行flutter doctor -v
, 警告消失,搞定!文章来源地址https://www.toymoban.com/news/detail-667699.html
wangyangyangdeMacBook-Pro:~ wangyang$ flutter doctor -v
[✓] Flutter (Channel stable, 3.7.9, on macOS 12.6.5 21G531 darwin-x64, locale
zh-Hans-CN)
• Flutter version 3.7.9 on channel stable at
/Users/wangyang/Developer/develop_env/flutter_3.7.9
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 62bd79521d (5 weeks ago), 2023-03-30 10:59:36 -0700
• Engine revision ec975089ac
• Dart version 2.19.6
• DevTools version 2.20.1
• Pub download mirror https://pub.flutter-io.cn
到了这里,关于消除Flutter doctor的警告Warning: `dart` on your path resolves to xxx/bin/dart的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!