Flutter MacOS 10.15 Running "flutter pub get"问题

现象:

在MacOS Catalina 10.15中通过命令行 “flutter create flutter_text“创建flutter项目出现:

Running "flutter pub get" in xx    (This is taking an unexpectedly long time

或者是:通过Android Studio创建flutter工程很慢
或者是:zsh: command not found: flutter问题

原因

从 macOS Catalina 版开始,Mac 将使用 zsh 作为默认登录 Shell 和交互式 Shell,终端启动时 ~/.bash_profile 将不会被加载,加载的是~/.zshrc文件

解决办法

将~/.bash_profile中的:

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

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

export PATH=/Users/xx/xxx/flutter/bin:$PATH

复制拷贝到~/.zshrc中,再使用source命令重新加载一下

source ~/.zshrc

注:
Flutter官网文档也有提到:https://book.flutterchina.club/chapter1/install_flutter.html
"在macOS上搭建Flutter开发环境" -> "更新环境变量" 部分中

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容