gpt4 book ai didi

android - 为什么 Flutter 只能以 super 用户身份运行?

转载 作者:IT王子 更新时间:2023-10-29 06:55:04 26 4
gpt4 key购买 nike

我最近尝试安装 Flutter我的 Macbook Pro 上的框架(2015 年初,MacOS v10.13.6)。我将包解压缩到 /Applications 目录中,并在我的 bash 配置文件中创建了相应的路径。但是,当以默认用户身份在终端上运行 flutter doctor 命令时,我遇到了以下错误。

shlock: open(/Applications/flutter/bin/cache/shlock2538): Permission denied
shlock: open(/Applications/flutter/bin/cache/shlock2540): Permission denied
shlock: open(/Applications/flutter/bin/cache/shlock2542): Permission denied
shlock: open(/Applications/flutter/bin/cache/shlock2544): Permission denied
shlock: open(/Applications/flutter/bin/cache/shlock2546): Permission denied
shlock: open(/Applications/flutter/bin/cache/shlock2548): Permission denied
shlock: open(/Applications/flutter/bin/cache/shlock2550): Permission denied

当我使用 super 用户权限 (sudo) 运行 flutter doctor 命令时,它能够运行,并且我得到以下终端输出。

Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
/
📎
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel beta, v0.5.1, on Mac OS X 10.13.6 17G65, locale en)
[✓] Android toolchain - develop for Android devices (Android SDK 28.0.1)
[!] iOS toolchain - develop for iOS devices (Xcode 9.4.1)
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.io/platform-plugins
To install:
brew install cocoapods
pod setup
[✓] Android Studio (version 3.1)
[!] Connected devices
! No devices available

! Doctor found issues in 2 categories.

我宁愿以默认用户身份运行 Flutter,也不愿以 super 用户权限运行(即使我从框架收到了以默认用户身份运行的警告)。

任何人都可以帮助我了解如何修复此错误并使用我的默认用户帐户开始运行 Flutter 框架吗?谢谢。

最佳答案

我尝试按照 Günter Zöchbauer 的回答更改 flutter 的位置。但是,flutter 仍然需要 super 用户权限。所以,我就这样直接给了他们

sudo chown -R $USER /Users/yourUser/flutter/

这对我来说效果很好。基本上,为特定文件夹授予用户权限。

关于android - 为什么 Flutter 只能以 super 用户身份运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51354351/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com