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

标签 android ios macos dart flutter

我最近尝试安装 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/

相关文章:

macos - 在 macOS 上的 python 2.7 上安装 rpy2

android - 需要解释 : getText() throws error on getActitvity()ut not on view

ios - .podspec 错误 - source_files` 模式不匹配任何文件

ios - NSInternalInconsistencyException',原因 : 'Invalid update: invalid number of items in section 1 - While having multiple Sections

ios - 在 ios 上调用 dlopen

objective-c - 检查整个枚举的相等性?

macos - AppleScript中的SQLite?

java - 通过 Smack android api 添加新用户到 ejabberd

android - SQLite异常: No such table found whereas a table was created

java - 如何在 android 的 Canvas 上绘制多段线?