安装flutter以后很多同学使用的临时路径 每次打开终端都需要重新export 路径
设置永久路径也没少爬坑,现在给出我的解决方案:
终端:open $HOME/.bash_profile
打开后添加:
export PATH=~flutter/bin:$PATH //(此路径为本地flutter路径)
//下面为本来就有的东西
[[ -s "$HOME/.profile" ]] && source "$HOME/.profile" # Load the default .profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
关闭,然后终端:source $HOME/.bash_profile
接着终端:open ~/.zshrc
在最上面添加:
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
source ~/.bash_profile
关闭,然后终端:source ~/.zshrc
然后就可以随意flutter命令了
如果还不行:
终端:open ~/.bashrc
改成这样:
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH=~/flutter/bin:$PATH //(此路径为本地flutter路径)
关闭,然后终端:source ~/.bashrc
$HOME/.bash_profile ~/.bashrc 两个文件改其一就可以
网友评论