【flutter环境搭建】flutter安装遇到报错 Error: The Flutter directory is not a clone of the GitHub project.

安装过程中输入 flutter doctor 报错:

Error: The Flutter directory is not a clone of the GitHub project.
       The flutter tool requires Git in order to operate properly;
       to set up Flutter, run the following command:
       git clone -b beta https://github.com/flutter/flutter.git

解决方法

在flutter根目录下手动创建一个 .git 文件夹
再次执行 flutter doctor,开始安装

安装过程中可能遇到报错 Error: Unable to 'pub upgrade' flutter tool
此时,只需在环境变量 -> 用户变量中添加下面两个变量

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn

【flutter环境搭建】flutter安装遇到报错 Error: The Flutter directory is not a clone of the GitHub project._第1张图片
【flutter环境搭建】flutter安装遇到报错 Error: The Flutter directory is not a clone of the GitHub project._第2张图片

你可能感兴趣的:(flutter)