flutter環境配置mac

1.官網下載sdk,解壓後到你想要放的文件目錄下,後解壓

注意:下載的sdk解壓後是flutter文件夾並且裏面有.git文件,不然會報下面的錯誤

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

2.找到你電腦的.bash_profile文件(沒有就新建),寫上下面的代碼

export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
export PATH='你安裝flutter SDK路徑'/flutter/bin:$PATH

3.再修改配置文件.zshrc,在文件末尾加上這句:source ~/.bash_profile

4.重新退出終端(一定要退出)後再打開終端執行$ source ~/.bash_profile 即可

5.執行 flutter doctor 查看是否配置成功

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章