React Native-无法通过Windows中的react-native-cli运行新项目

时间:2019-10-14 14:15:57

标签: reactjs react-native react-native-android

我可以在本地本机CLI中启动新项目,但是使用react-native run-android运行应用程序时出现错误。按照https://facebook.github.io/react-native/docs/getting-started中的说明进行配置。在Android模拟器上运行的Expo应用程序没有任何错误。

节点js:8.11.1 CLI:@ react-native-community / cli @ 2.9.0

已尝试: 将NodeJS从12降级到8.x

我在终端中遇到以下错误

info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 892 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
Downloading https://services.gradle.org/distributions/gradle-5.4.1-all.zip
..............................................................................................................................

Welcome to Gradle 5.4.1!

Here are the highlights of this release:
 - Run builds with JDK12
 - New API for Incremental Tasks
 - Updates to native projects, including Swift 5 support

For more details see https://docs.gradle.org/5.4.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'newkitten'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.4.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.4.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

* 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 5m 13s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'newkitten'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.4.1.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.4.1.
         > Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom'.
            > Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.4.1/gradle-3.4.1.pom'.
               > sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

* 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 5m 13s

    at checkExecSyncError (child_process.js:601:13)
    at execFileSync (child_process.js:621:13)
    at runOnAllDevices (D:\workspace\newkitten\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
    at buildAndRun (D:\workspace\newkitten\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
    at then.result (D:\workspace\newkitten\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

0 个答案:

没有答案