簡體   English   中英

如果我不是Sudo,React-Native無法運行項目

[英]React-Native cannot run project if I am not Sudo

我無法使用代碼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用戶的情況下運行?

通過閱讀Medium的文章 ,我發現當您在安裝react native和realized工具時遇到權限問題時,您必須顯式地授予每個文件夾權限,以便您可以在不使用sudo的情況下運行該應用程序。 否則,sudo安裝的文件只能作為sudo運行。

使用以下命令為該特定文件夾的當前用戶授予訪問權限

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM