消除Flutter doctor的警告Warning: `dart` on your path resolves to xxx/bin/dart

简介: 消除Flutter doctor的警告Warning: `dart` on your path resolves to xxx/bin/dart

问题描述

最新更新了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引发的警告。

再次运行flutter doctor -v, 警告消失,搞定!

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

相关文章
|
2月前
|
Dart
如何在 Flutter 项目中使用 Dart 语言?
如何在 Flutter 项目中使用 Dart 语言?
127 58
|
18天前
|
Dart
flutter dart mixin 姿势
flutter dart mixin 姿势
|
1月前
|
Dart 开发者 Windows
flutter:dart的学习
本文介绍了Dart语言的下载方法及基本使用,包括在Windows系统上和VSCode中的安装步骤,并展示了如何运行Dart代码。此外,还详细说明了Dart的基础语法、构造函数、泛型以及库的使用方法。文中通过示例代码解释了闭包、运算符等概念,并介绍了Dart的新特性如非空断言操作符和延迟初始化变量。最后,提供了添加第三方库依赖的方法。
28 12
|
6月前
|
前端开发 C++ 容器
Flutter-完整开发实战详解(一、Dart-语言和-Flutter-基础)(1)
Flutter-完整开发实战详解(一、Dart-语言和-Flutter-基础)(1)
|
3月前
|
Dart 前端开发 JavaScript
Flutter&Dart-异步编程Future、Stream极速入门
Flutter&Dart-异步编程Future、Stream极速入门
72 4
Flutter&Dart-异步编程Future、Stream极速入门
|
3月前
|
Dart JavaScript 前端开发
Dart或Flutter中解决异常-type ‘int‘ is not a subtype of type ‘double‘
Dart或Flutter中解决异常-type ‘int‘ is not a subtype of type ‘double‘
128 4
|
3月前
|
Dart
Flutter笔记:手动配置VSCode中Dart代码自动格式化
Flutter笔记:手动配置VSCode中Dart代码自动格式化
444 5
|
3月前
|
Dart 开发工具 Android开发
Android Studio导入Flutter项目提示Dart SDK is not configured
Android Studio导入Flutter项目提示Dart SDK is not configured
296 4
|
4月前
|
JSON Dart 安全
Flutter Dart Macro 宏简化 JSON 序列化
今天我们将会体验 dart 语言新特性 macro 宏,来实现对 json 的序列化,用到的包是官方实验室写的 json 包。 本文将会一步步的带你实现这个功能,那我们开始吧。
Flutter Dart Macro 宏简化 JSON 序列化
|
3月前
|
Dart 安全 API
Android跨平台开发之Dart 3.5 与 Flutter 3.24:革新跨平台应用开发
【Dart 3.5 与 Flutter 3.24:革新跨平台应用开发】首发于公众号“AntDream”。本文深度解析 Dart 3.5 和 Flutter 3.24 的新特性,包括空安全强化、Web 与原生互操作性增强及 Flutter GPU API 等,展示了如何提升代码质量和用户体验。
63 1