【问题标题】:React-Native cannot run project if I am not Sudo如果我不是 Sudo,React-Native 无法运行项目
【发布时间】:2019-10-03 09:13:04
【问题描述】:

我无法使用代码 react-native run-android 运行 react-native 项目。我收到以下错误

info Starting JS server...
info Building and installing the app on the device (cd android && ./gradlew app:installDebug)...

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not create service of type AnnotationProcessorDetector using JavaGradleScopeServices.createAnnotationProcessorDetector().

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1s
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: ./gradlew app:installDebug. Run CLI with --verbose flag for more details.

但如果我以 root `sudo react-native run-andoid' 运行它,它就会运行。

如何让项目在没有 root 权限的情况下运行??

【问题讨论】:

    标签: javascript android react-native terminal jsx


    【解决方案1】:

    我在阅读 Medium 的 post 时发现,当您在安装 react native 和 realated 工具时遇到权限问题时,您必须明确授予每个文件夹的权限,这样您就可以在不使用 sudo 的情况下运行应用程序。否则sudo安装的文件只能sudo运行。

    使用以下命令授予当前用户对该特定文件夹的访问权限

    sudo chown -R $(whoami) ~/Documents/Myapplicationfolder
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-20
      • 2016-07-12
      • 2016-05-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多