RN ... pod install / pod repo update 巨慢?

$ gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.com/

1、如果有需要,切换一下镜像,快一点
切换镜像源:https://mirror.tuna.tsinghua.edu.cn/help/CocoaPods/

$ cd ~/.cocoapods/repos 
$ pod repo remove master
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master

进入自己的工程,在自己工程的podFile第一行加上:

source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'

2、clone 到 double-conversion 这一步的时候停住了

Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Downloading dependencies
Installing CocoaAsyncSocket (7.6.4)
Installing CocoaLibEvent (1.0.0)
Installing DoubleConversion (1.1.6)

[!] Error installing DoubleConversion
[!] /usr/bin/git clone https://github.com/google/double-conversion.git /var/folders/hk/mvwx507x37x7lrqxqlc5jhs80000gn/T/d20200516-56073-1nk52ct --template= --single-branch --depth 1 --branch v1.1.6

Cloning into '/var/folders/hk/mvwx507x37x7lrqxqlc5jhs80000gn/T/d20200516-56073-1nk52ct'...
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: unpack-objects failed

于是想着有没有办法自己 copy下来,
—— react-native 源码, 在 react-native/tree/0.62-stable (根据自己的版本)下,找到最难下载的这几个:

fetch_and_unpack glog-0.3.5.tar.gz https://github.com/google/glog/archive/v0.3.5.tar.gz 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc "\"$SCRIPTDIR/ios-configure-glog.sh\""
fetch_and_unpack double-conversion-1.1.6.tar.gz https://github.com/google/double-conversion/archive/v1.1.6.tar.gz 1c7d88afde3aaeb97bb652776c627b49e132e8e0
fetch_and_unpack boost_1_63_0.tar.gz https://github.com/react-native-community/boost-for-react-native/releases/download/v1.63.0-0/boost_1_63_0.tar.gz c3f57e1d22a995e608983effbb752b54b6eab741
fetch_and_unpack folly-2018.10.22.00.tar.gz https://github.com/facebook/folly/archive/v2018.10.22.00.tar.gz f70a75bfeb394363d2049a846bba118ffb3b368a

这里可以通过GitHub 的地址去找它的 release 版本,下载它的 source code ,例如刚刚下不来的 https://github.com/google/double-conversion

也找到了别人分享的 百度云地址 rn-third-party ,直接下载下来咯

cd ~/Library/Caches
mkdir com.facebook.ReactNativeBuild
#将上面的文件直接拷贝到这个目录下

不过还是会失败。。cancel 重新 install 就 clone下来了。。好吧,不是最好的方法,而且又遇到了新的问题

3、clone 到 boost-for-react-native 的时候怎么都 clone 不下来

[!] Error installing boost-for-react-native
[!] /usr/bin/git clone https://github.com/react-native-community/boost-for-react-native.git /var/folders/hk/mvwx507x37x7lrqxqlc5jhs80000gn/T/d20200516-65745-8mi4c0 --template= --single-branch --depth 1 --branch v1.63.0-0

Cloning into '/var/folders/hk/mvwx507x37x7lrqxqlc5jhs80000gn/T/d20200516-65745-8mi4c0'...
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

于是考虑另一种方案,换 clone 源,在码云找了个 boost-for-react-native , 然后在 ios/Podfile 文件中加入:

#在 target 'projectname' do 后面添加:
pod 'boost-for-react-native', :git => 'https://gitee.com/damon-s/boost-for-react-native.git’

搞定!

你可能感兴趣的:(RN ... pod install / pod repo update 巨慢?)