简体   繁体   English

尝试添加定位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"

Trying to add path to locate flutter so 'flutter doctor' can be run, to solve zsh: command not found: flutter , then I found that creating below is first step to solution, but again terminal says nano ~/.bash_profile zsh: command not found: nano尝试添加路径来定位颤振,以便可以运行“颤振医生”,以解决zsh: command not found: flutter ,然后我发现在下面创建是解决方案的第一步,但终端再次说nano ~/.bash_profile zsh: command not found: nano

then trying to create bash profile also not working, may be it's existing, but somehow it says below.然后尝试创建 bash 配置文件也不起作用,可能它已经存在,但不知何故它在下面说。 $HOME/.bash_profile zsh: permission denied: /Users/prettygirl/.bash_profile $HOME/.bash_profile zsh: permission denied: /Users/prettygirl/.bash_profile

terminal is given full file access in macOS restarted my macmini vscode quitted and restarted, terminal quitted and restarted终端在 macOS 中获得完整文件访问权限重新启动我的 macmini vscode 退出并重新启动,终端退出并重新启动

problem still persists.问题仍然存在。 Is there any way to add path variables easily than going through all this hassle with terminal?有没有什么方法可以轻松地添加路径变量,而不是通过终端来解决所有这些麻烦? like macos menu or something to add system path variables?像 macos 菜单或添加系统路径变量的东西?

You're trying to open your bash_profile using nano (text editor) which you don't have installed.您正在尝试使用尚未安装的nano (文本编辑器)打开bash_profile You can open that file using any text editor you have.您可以使用您拥有的任何文本编辑器打开该文件。 Also, I see you're using zsh and not bash, this means that you should actually edit your ~/.zshrc or ~/.zprofile instead and add另外,我看到你正在使用的zsh和bash的不是,这意味着你实际上应该编辑您的~/.zshrc~/.zprofile代替,并添加

PATH=</path/to/flutter>:$PATH

where you replace </path/to/flutter> with the actual path to flutter on your machine.您将</path/to/flutter>替换为在您的机器上抖动的实际路径。 You can do this if you don't want to add it manually:如果您不想手动添加它,您可以这样做:

echo 'export PATH=</path/to/flutter>:$PATH' >> ~/.zshrc && source ~/.zshrc

again, replacing </path/to/flutter> with your actual flutter path.再次将</path/to/flutter>替换为您的实际颤振路径。

This is the only thing that worked for me.这是唯一对我有用的东西。 Go to where your flutter folder is and right-click, get info, and copy where the path then paste it in the YOUR_PATH part below.转到 flutter 文件夹所在的位置,然后右键单击,获取信息,然后复制路径所在的位置,然后将其粘贴到下面的 YOUR_PATH 部分中。 Open the .zshrc file using the command: nano ~/.zshrc, Now add the following to the file: export PATH="$PATH:/YOUR_PATH/flutter/bin/" Save the file by pressing Control + X followed by Enter.使用以下命令打开 .zshrc 文件:nano ~/.zshrc,现在将以下内容添加到文件中: export PATH="$PATH:/YOUR_PATH/flutter/bin/" 按 Control + X 然后按 Enter 保存文件。 Apply the changes by command: source ~/.zshrc通过命令应用更改: source ~/.zshrc

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM