[英]MacOS gives zsh: command not found: flutter after updating path according to Flutter
Recently I updated Mac OS to latest Catalina and my terminal which is using zsh now start showing me following error:最近我将 Mac OS 更新为最新的 Catalina,我使用 zsh 的终端现在开始向我显示以下错误:
zsh: command not found: flutter
It was working fine before update更新前工作正常
First of all, I suggest using FVM (Flutter Version Management).首先,我建议使用 FVM(Flutter 版本管理)。 Which is a great tool, that can be used to install and switch between Flutter versions easily.
这是一个很棒的工具,可以用来轻松安装和切换 Flutter 版本。
https://fvm.app https://fvm.app
Concerning zsh, you could create a file named ~/.zshenv
where you can configure path variables.关于 zsh,您可以创建一个名为
~/.zshenv
的文件,您可以在其中配置路径变量。 It works a bit differently than with bash.它的工作方式与 bash 略有不同。
#!/bin/zsh
# makes path an array with unique elements
typeset -U path
# adds flutter to the path
path+=('/Users/XXX/Tools/FVM/default/bin')
# adds global dart packages to the path
path+=('/Users/XXX/.pub-cache/bin')
export PATH
As you can see, I use Flutter with FVM, but you can of course just download Flutter yourself and provide the path in the .zshenv
file.如您所见,我将 Flutter 与 FVM 一起使用,但您当然可以自己下载 Flutter 并在
.zshenv
文件中提供路径。 After changing the file you may want to run source ~/.zshenv
, to make the changes available in the running terminal session.更改文件后,您可能需要运行
source ~/.zshenv
,以使更改在正在运行的终端会话中可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.