正如所描述的,我正在制作一个脚本来自动清理我的构建并重新安装我的依赖项,结果意外地运行了
flutter clean
作为根用户。我没有意识到这会是一个问题,但flutter在继续之前发出了以下警告
Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
之后,我现在不能跑步了
颤振清洁
或
flutter pub get
没有超级用户权限
例如之后
颤振清洁
:
Flutter failed to delete a directory at "/Users/liamhp/Documents/<my-app>/.dart_tool".
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.
和
扑腾酒吧
Generating synthetic localizations package failed with 1 error:
Error: Flutter failed to write to a file at "/Users/liamhp/Documents/<my-app>/.dart_tool/flutter_gen/gen_l10n/app_localizations_en.dart".
Please ensure that the SDK and/or project is installed in a location that has read/write permissions for the current user.
Try running:
sudo chown -R $(whoami) /Users/liamhp/Documents/<my app>/.dart_tool/flutter_gen/gen_l10n/app_localizations_en.dart
当我以root用户身份运行命令时,它似乎仍然有效,但我通常希望避免这样做。这里发生了什么?我如何撤消它?我已经尝试卸载并重新安装flutter