消除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

相关文章
|
26天前
|
开发框架 Dart 前端开发
Flutter 是谷歌推出的一款高效跨平台移动应用开发框架,使用 Dart 语言,具备快速开发、跨平台支持、高性能、热重载及美观界面等特点。
Flutter 是谷歌推出的一款高效跨平台移动应用开发框架,使用 Dart 语言,具备快速开发、跨平台支持、高性能、热重载及美观界面等特点。本文从 Flutter 简介、特点、开发环境搭建、应用架构、组件详解、路由管理、状态管理、与原生代码交互、性能优化、应用发布与部署及未来趋势等方面,全面解析 Flutter 技术,助你掌握这一前沿开发工具。
56 8
|
3月前
|
Dart
如何在 Flutter 项目中使用 Dart 语言?
如何在 Flutter 项目中使用 Dart 语言?
137 58
|
1月前
|
Dart
flutter dart mixin 姿势
flutter dart mixin 姿势
|
2月前
|
Dart 开发者 Windows
flutter:dart的学习
本文介绍了Dart语言的下载方法及基本使用,包括在Windows系统上和VSCode中的安装步骤,并展示了如何运行Dart代码。此外,还详细说明了Dart的基础语法、构造函数、泛型以及库的使用方法。文中通过示例代码解释了闭包、运算符等概念,并介绍了Dart的新特性如非空断言操作符和延迟初始化变量。最后,提供了添加第三方库依赖的方法。
34 12
|
7月前
|
前端开发 C++ 容器
Flutter-完整开发实战详解(一、Dart-语言和-Flutter-基础)(1)
Flutter-完整开发实战详解(一、Dart-语言和-Flutter-基础)(1)
|
4月前
|
Dart 前端开发 JavaScript
Flutter&Dart-异步编程Future、Stream极速入门
Flutter&Dart-异步编程Future、Stream极速入门
89 4
Flutter&Dart-异步编程Future、Stream极速入门
|
5月前
|
JSON Dart 安全
Flutter Dart Macro 宏简化 JSON 序列化
今天我们将会体验 dart 语言新特性 macro 宏,来实现对 json 的序列化,用到的包是官方实验室写的 json 包。 本文将会一步步的带你实现这个功能,那我们开始吧。
Flutter Dart Macro 宏简化 JSON 序列化
|
4月前
|
Dart
Flutter笔记:手动配置VSCode中Dart代码自动格式化
Flutter笔记:手动配置VSCode中Dart代码自动格式化
566 5
|
4月前
|
Dart JavaScript 前端开发
Dart或Flutter中解决异常-type ‘int‘ is not a subtype of type ‘double‘
Dart或Flutter中解决异常-type ‘int‘ is not a subtype of type ‘double‘
156 4
|
4月前
|
Dart 开发工具 Android开发
Android Studio导入Flutter项目提示Dart SDK is not configured
Android Studio导入Flutter项目提示Dart SDK is not configured
389 4