找不到Ubuntu 18.04上的Flutter错误'flutter'命令

时间:2019-06-02 03:40:35

标签: flutter ubuntu-18.04

我正在尝试在ubuntu 18.04上安装flutter。从link下载flutter软件包后,我设置了PATH变量,此后,每当我尝试在终端上执行flutter时,它都会给出错误command not found

即使我尝试在flutter/bin内执行flutter命令,结果仍然相同!

我尝试重新启动,然后检查结果还是一样。

这是我的 .bash_profile 的样子

rajath@rajath-Inspiron:~/Downloads/flutter/bin$ cat ~/.bash_profile 
export JAVA_HOME=/usr/lib/jvm/default-java

export ANDROID_HOME=/opt/Android
export PATH=$PATH:$ANDROID_HOME/tools 
export PATH=$PATH:$ANDROID_HOME/platform-tools

export PATH=/Downloads/flutter/bin:$PATH

错误日志:

rajath@rajath-Inspiron:~/Downloads/flutter/bin$ flutter doctor
flutter: command not found
rajath@rajath-Inspiron:~/Downloads/flutter/bin$ flutter
flutter: command not found
rajath@rajath-Inspiron:~/Downloads/flutter/bin$ 

任何帮助将不胜感激!!!

2 个答案:

答案 0 :(得分:1)

您还可以将export PATH=$PATH:~/Downloads/flutter/bin添加到~/.bashrc中。

每次启动新bash时,都会将flutter路径添加到path变量中。

也许您应该在/usr/附近的任何地方安装颤振器

答案 1 :(得分:0)

正如worldpotato所说,您必须添加到.bashrc文件(或.bash_profile)中

您可以运行命令

echo 'export PATH="$PATH:~/Downloads/flutter/bin"' >> ~/.bashrc

echo 'export PATH="$PATH:~/Downloads/flutter/bin"' >> ~/.bash_profile