我最近尝试在我的 Macbook Pro(2015 年初,MacOS v10.13.6)上安装Flutter框架。我将包解压到/Applications目录中,并在 bash 配置文件中创建了相应的路径。但是,当flutter doctor以默认用户身份在终端上运行命令时,我遇到以下错误。
shlock: open(/Applications/flutter/bin/cache/shlock2538): Permission denied\nshlock: open(/Applications/flutter/bin/cache/shlock2540): Permission denied\nshlock: open(/Applications/flutter/bin/cache/shlock2542): Permission denied\nshlock: open(/Applications/flutter/bin/cache/shlock2544): Permission denied\nshlock: open(/Applications/flutter/bin/cache/shlock2546): Permission denied\nshlock: open(/Applications/flutter/bin/cache/shlock2548): Permission denied\nshlock: open(/Applications/flutter/bin/cache/shlock2550): Permission denied\nRun Code Online (Sandbox Code Playgroud)\n\n当我flutter doctor使用超级用户权限 ( sudo) 运行该命令时,它能够运行,并且得到以下终端输出。
Woah! You appear to be trying to run flutter as root.\n We strongly recommend running the flutter tool without superuser privileges.\n /\n\nDoctor summary (to see all details, run flutter doctor -v):\n[\xe2\x9c\x93] Flutter (Channel …Run Code Online (Sandbox Code Playgroud)