首页 > 解决方案 > 如何在macos上完全卸载flutter并以正确的方式重新安装?

问题描述

在我的 macOs BigSur 上安装颤振时遇到了一个问题,因为我设置了颤振路径错误的方式并且我把一切都搞砸了。

我只是想要一种完全卸载颤振并以正确方式重新安装的方法。

ro:~ yahyasaleh$ which flutter
YAHYAs-MacBook-Pro:~ yahyasaleh$ 
YAHYAs-MacBook-Pro:~ yahyasaleh$ flutter docker
-bash: flutter: command not found
YAHYAs-MacBook-Pro:~ yahyasaleh$  echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:[/Users/yahyasaleh/Developer/flutter/bin]/flutter/bin
YAHYAs-MacBook-Pro:~ yahyasaleh$ git clean -xfd
fatal: not a git repository (or any of the parent directories): .git
YAHYAs-MacBook-Pro:~ yahyasaleh$ git stash save --keep-index
fatal: not a git repository (or any of the parent directories): .git
YAHYAs-MacBook-Pro:~ yahyasaleh$ git stash drop
fatal: not a git repository (or any of the parent directories): .git
YAHYAs-MacBook-Pro:~ yahyasaleh$ git pull
fatal: not a git repository (or any of the parent directories): .git
YAHYAs-MacBook-Pro:~ yahyasaleh$ flutter doctor
-bash: flutter: command not found
YAHYAs-MacBook-Pro:~ yahyasaleh$ rm -rf
YAHYAs-MacBook-Pro:~ yahyasaleh$ which flutter
YAHYAs-MacBook-Pro:~ yahyasaleh$ git clean -xfd
fatal: not a git repository (or any of the parent directories): .git
YAHYAs-MacBook-Pro:~ yahyasaleh$ 

标签: fluttermobilemobile-development

解决方案


Flutter 是一个 SDK,您可以下载并解压到 Mac 的目录中。与没有自动安装过程一样,没有自动卸载过程。您通过下载一个 zip 文件并解压缩它来“安装”它。您所要做的就是删除解压缩目录的内容。

即使是能够从系统中的任何位置调用颤振命令的路径添加也必须手动完成。如果你这样做了,那么你也可以从你的 shell 的 PATH 中删除它。

您可以 rm -rf sdk 文件夹,或者如果您只想清理损坏的文件,请在 Flutter 安装目录中运行以下命令:

git clean -xfd
git stash save --keep-index
git stash drop
git pull
flutter doctor

推荐阅读