无法 HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'。从服务器接收到状态代码 502:Bad Gateway

Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

我正在尝试为 android 构建我的 react-native 项目并在 Windows 上收到以下错误,但它在 Mac.

上运行
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1090 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
> Task :react-native-get-sms-android:generateDebugRFile FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings
128 actionable tasks: 128 executed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-get-sms-android:generateDebugRFile'.
> Could not resolve all files for configuration ':react-native-get-sms-android:debugCompileClasspath'.
   > Could not resolve com.facebook.react:react-native:+.
     Required by:
         project :react-native-get-sms-android
      > Failed to list versions for com.facebook.react:react-native.
         > Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml.
            > Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'. Received status code 502 from server: Bad Gateway

* 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 24s

我的环境:

在用谷歌搜索 bintray 已关闭的错误时找到了解决方案,其状态可以在 https://status.bintray.com 上进行跟踪。

但构建项目 在 Mac 环境 上运行良好,同时 在 WindowsReceived status code 502 from server: Bad Gateway。关于这种奇怪行为的任何线索?

我遇到了同样的问题,我通过以下更改解决了这个问题:

如果 Osvaldo 的解决方案不起作用,另一种方法是更新您的依赖项本身,它在当前版本的 gradle 中依赖于 jcenter。

在这种情况下,它是 react-native-get-sms-android。更新它可能会从 jcenter 中释放它。

就我而言,它是 react-native-sqlite-2 的旧版本。