reactnativecn / react-native-website

React Native 中文网
https://reactnative.cn
MIT License
216 stars 327 forks source link

使用官方提供的项目指令,第一次启动后,总是卡在这两个以来安装这里,已经失败很多次了,vpn应该也是稳定的 #731

Closed hyf940760301 closed 8 months ago

hyf940760301 commented 11 months ago

请按以下格式提供问题的相关信息。

问题的具体描述

image 通过yarn react-native run-android指令启动项目,总是卡在这两个依赖安装上面,已经失败了好几次了

image 官方文档中说换成maven镜像,但是在脚手架搭建的项目中只找到了一处google()并且已经进行了替换。下面这张是 android/build.gradle文件替换后的 image

请描述完整的环境/版本信息

当前的环境: node:16.16.0

stealPigs-youth commented 11 months ago

还是因为gradle下载文件太慢 我建议你像我一样: 1、下载自己的gradle8.x版本 2、配置gradle环境变量:GRADLE_HOME、GRADLE_USER_HOME 3、在gradle根目录下的init.d文件中,创建init.gradle init.gradle内容 allprojects{ repositories{ mavenLocal() maven {name "jcenter" ; url 'https://maven.aliyun.com/repository/jcenter' } maven {name "google" ; url 'https://maven.aliyun.com/repository/google' } maven {name "central" ; url "https://maven.aliyun.com/repository/central"} maven {name "public" ; url "https://maven.aliyun.com/repository/public"} maven {name "gradle-plugin" ; url "https://maven.aliyun.com/repository/gradle-plugin"} maven {name "apache-snapshots" ; url "https://maven.aliyun.com/repository/apache-snapshots"} maven {name "Bstek" ; url "https://nexus.bsdn.org/content/groups/public/"} mavenCentral() }

buildscript{
    repositories{
        maven {name "jcenter"  ; url 'https://maven.aliyun.com/repository/jcenter' }
        maven {name "google" ; url 'https://maven.aliyun.com/repository/google' }
        maven {name "central" ; url "https://maven.aliyun.com/repository/central"}
        maven {name "public" ; url "https://maven.aliyun.com/repository/public"}
        maven {name "gradle-plugin" ; url "https://maven.aliyun.com/repository/gradle-plugin"}
        maven {name "apache-snapshots" ; url "https://maven.aliyun.com/repository/apache-snapshots"}
        maven {name "Bstek" ; url "https://nexus.bsdn.org/content/groups/public/"}
        maven {name "M2" ; url "https://plugins.gradle.org/m2/"}
    }
}

}

sunnylqm commented 11 months ago

gradle不需要手动下载(上面的截图也表示gradle已经在正常运行了),我看了下文档,目前jcenter已经过期,需要替换mavenCentral,见文档刚刚的修改

https://github.com/reactnativecn/react-native-website/commit/5d71dfcac409c6813b022b6c0dc8a75c26ee82d2#diff-1ae78e4a7ef48cebdfcc656d4366cd60fb9826bee006ef99b29d569bce7eb2fdR165

coder-ahao commented 11 months ago

直接去阿里maven仓库手动下载下来,自己放到指定的本地目录就好了。https://developer.aliyun.com/mvn/search

stealPigs-youth commented 11 months ago

下载自己的gradle比较好,这样%GRADLE_HOME%/init.d/init.gradle中的远程镜像可以使用,还可以有自己的本地的gradle缓存仓库,但是maven { url 'https://maven.aliyun.com/repository/jcenter' }这个已经不能用了

sunnylqm commented 11 months ago

gradle的版本是随项目走动的(不同版本的rn会使用不同版本的gradle,手动改变这个版本可能带来很多问题),而gradle目前官方的cdn在国内并没有啥障碍,所以下载下来没有啥意义

github-actions[bot] commented 8 months ago

👋 Hey there, it looks like there has been no activity on this issue in the last 90 days. Has the issue been fixed, or does it still require the community attention? This issue will be closed in the next 7 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 8 months ago

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.