问题描述 : zsh: command not found XXX 类似以下情况
问题:重启电脑之后VSCode的 桌面找不到 flutter ,或者下载了SDK 找不到flutter
1.显示 / 关闭隐藏文件快捷键
command + shift + .
解决办法有两种, 效果图
解决办法1:永久有效 把代码放到 ~/.zshrc
export FLUTTER_HOME=你存放SDK的路径/flutter
export PATH=$PATH:$FLUTTER_HOME/bin
export PATH=$PATH:$FLUTTER_HOME/bin/cache/dart-sdk/bin
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE=https://storage.flutter
然后执行source ~/.zshrc
==========================
解决办法2:这个每次重启得要从新运行source ~/.bash_profile
前往 输入 ~/.bash_profile
添加代码
export FLUTTER_HOME=你存放SDK的路径/flutter
export PATH=$PATH:$FLUTTER_HOME/bin
export PATH=$PATH:$FLUTTER_HOME/bin/cache/dart-sdk/bin
export PUB_HOSTED_URL=https://pub.flutter-io.cn
export FLUTTER_STORAGE_BASE=https://storage.flutter
最后执行
source ~/.bash_profile //这是关键, 每次重启电脑后,再次执行这行代码, 就可找到flutter
===============================================================
之后就可以使用了
flutter doctor
flutter run
flutter doctor 之后出现下面 就是对的
然后cd app路径
执行 fultter run 显示对应模拟器
这是因为设备过多, 你需要指定设备运行
fultter run -d 设备ID
或者执行这个也可以
flutter attach -d 设备ID
========================================================
参考:https://blog.csdn.net/m0_37508087/article/details/105666336?utm_medium=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-BlogCommendFromMachineLearnPai2-1.channel_param