美文网首页
Flutter 打包报错:zsh:command not fou

Flutter 打包报错:zsh:command not fou

作者: 大成小栈 | 来源:发表于2023-08-03 14:21 被阅读0次

问题:
1)Android Studio使用Terminal执行Flutter命令 >> zsh: command not found: flutter;
2)每次重新打开Terminal窗口执行flutter命令,又提示:zsh: command not found: flutter。
3)通过每次打开终端执行一下:source ~/.bash_profile,再使用flutter命令即可通过。

问题原因:

Flutter开发库的路径、环境配置不全面,导致出错。其中涉及到两个文件:bash_profile、zshrc。

解决方案:

  1. 执行【open ~/.bash_profile 】

  2. 将下面内容粘贴到.bash_profile文件
    export PATH="$PATH:/[替换为你的Flutter安装路径]/bin"

  3. 执行【source ~/.bash_profile 】,将.bash_profile文件生效

  4. 执行【flutter doctor】测试效果。

  5. 执行:【open ~/.zshrc 】
    如果 提示文件不存在,则执行:【vim ~/.zshrc 】新建一个新文件。

  6. 再执行【open ~/.bash_profile 】

  7. 把 bash_profile 中的内容copy到 zshrc 文件中,保存:esc ->【:wq!回车】。

  8. 再使用source命令重新加载一下:【source ~/.zshrc】,下次再编辑这个文件就可以直接执行【open ~/.zshrc】

  9. 重启Android Studio/终端,再次执行【flutter doctor】测试效果。

相关文章

网友评论

      本文标题:Flutter 打包报错:zsh:command not fou

      本文链接:https://www.haomeiwen.com/subject/exumpdtx.html