简体   繁体   English

MacOS给出zsh: command not found: 根据Flutter更新路径后flutter

[英]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.

相关问题 zsh:找不到命令:flutter,添加parmanent路径后 - zsh: command not found: flutter,after adding parmanent path 在“.zshrc”文件中给出路径后的“zsh: command not found: flutter” - “zsh: command not found: flutter” after the path is given in “.zshrc” file zsh:找不到命令:flutter? - zsh: command not found: flutter? zsh: command not found: flutter 为 MacOS 创建新文件夹时 - zsh: command not found: flutter when creating new folder for MacOS 颤振医生'zsh:找不到命令' - flutter doctor 'zsh: command not found' 尝试添加定位flutter的路径以运行“flutter doctor”来解决“zsh: command not found: flutter” - Trying to add path to locate flutter to run "flutter doctor" to solve "zsh: command not found: flutter" macOS High Sierra - 找不到 flutter 命令 - macOS High Sierra - flutter command not found zsh: command not found: genhtml (Flutter + Code Coverage using Codemagic) - zsh: command not found: genhtml (Flutter + Code Coverage using Codemagic) 我已经安装了 flutter 和 android studio 但仍然收到错误 zsh: command not found: flutter - I have installed the flutter and android studio but still getting the error zsh: command not found: flutter Flutter SDK 在 MacOS 之后在 Windows 上运行应用程序后路径发生变化 - Flutter SDK path changed after running the app on Windows after MacOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM