Mac 安装flutter

2020-11-13  本文已影响0人  小柴2011

1、使用git clone 拉取flutter代码

2、按照flutter官网配置环境后执行flutter doctor 报错:-bash: flutter: command not found

3、执行open -e .bash_profile 报错:The file /Users/xxx/.bash_profile does not exist.说明你还没有这个文件,此时就需要创建一个,若是有的这个文件的小伙则可以直接进入步骤

4、创建`.bash_profile文件:touch .bash_profile

5、设置flutter环境变量,创建完成之后,再次执行前面的open命令,打开了我们的.bash_profile文件.

要是你之前有这个文件的话,应该会看到一些export PATH=${PATH}...之类的配置项.

此时直接在最末尾处追加设置flutter bin目录路径为环境变量:

exportPATH=${PATH}:/Users/lindaidai/app/flutter/bin

6、保存关闭.bash_profile文件之后,需要执行以下命令,更新环境变量:source ~/.bash_profile

7、执行flutter doctor(如果遇到全新问题,请参照另一篇博客https://www.jianshu.com/writer#/notebooks/4435883/notes/79816678)

上一篇 下一篇

猜你喜欢

热点阅读