【问题标题】:Flutter not found error on macOS though ive set up path variable in bash_profile尽管我在 bash_profile 中设置了路径变量,但 Flutter 在 macOS 上未发现错误
【发布时间】:2020-01-09 06:17:57
【问题描述】:

我尝试在我的 macOS 上安装颤振,但每当我在终端上运行颤振命令时,它都会显示颤振未找到。我在 Application 文件夹中提取了 Flutter SDK,并在 .bash_profile 中添加了路径。仍然没有用。 Attaching the Bash file and terminal screenshots here.

我添加的路径是 - export PATH="/Users/ritishkannayagari/Applications/flutter/bin:$PATH"

【问题讨论】:

  • 运行命令时显示什么:echo $PATH?你有没有运行命令:source ~/.bash_profile?
  • @PhucTran 我将路径保存在 bash_profile 中,然后运行源 ~/.bash_profile 并回显 $PATH,但是当我在新窗口上运行终端时,它再次显示未找到颤振命令跨度>
  • Echo Path before 我运行 source ~/.bash_profile - /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin 然后在运行source~/.bash_profile 后 echo $PATH 是 /Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/ritishkannayagari/anaconda3/bin:/Users/ritishkannayagari/anaconda3/condabin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Users/ritishkannayagari/Applications/flutter/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin @PhucTran

标签: bash flutter


【解决方案1】:

您正在终端中使用zsh。您可以:

  • 在终端中切换到bash

Terminal > Preferences > Shells 打开:/bin/bash


  • 保留zsh并将颤振路径添加到~/.zshrc
echo 'export PATH="$HOME/Applications/flutter/bin:$PATH"' >> ~/.zshrc

然后重启终端


  • 保留zsh 在您的~/.zshrc 中添加source ~/.bash-profile
echo 'source ~/.bash-profile' >> ~/.zshrc

【讨论】:

  • 你能告诉我该怎么做吗?
猜你喜欢
  • 2019-07-25
  • 1970-01-01
  • 2016-01-31
  • 2011-09-04
  • 2013-10-14
  • 2019-11-01
  • 1970-01-01
  • 2018-07-22
  • 1970-01-01
相关资源
最近更新 更多