发现码云的好像有点问题,可以换成清华大学的试试:
https://mirrors.tuna.tsinghua.edu.cn/help/CocoaPods/
周末因为MAC没电,所以一直都没折腾IOS的运行。今天充电了就赶紧试一下。
结果,一运行就报错:
> AwesomeProject@0.0.1 ios /Users/allahbin/ReactNativeProject/AwesomeProject
> react-native run-ios
error Could not find "Podfile.lock" at /Users/allahbin/ReactNativeProject/AwesomeProject/ios/Podfile.lock. Did you run "pod install" in iOS directory?
info Found Xcode project "AwesomeProject.xcodeproj"
info Building (using "xcodebuild -project AwesomeProject.xcodeproj -configuration Debug -scheme AwesomeProject -destination id=EC0DFD10-3FBB-41E1-87A9-CDED2ED40625")
.................
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening AwesomeProject.xcodeproj. Run CLI with --verbose flag for more details.
Command line invocation:
上面写了,Did you run "pod install" in iOS directory
,好吧,很听话的去ios目录输入了pod install
然后就报错。。。
太难了。。。
反正拿着那个错误,大部分都是让去改Podfile
这个文件,也就是这个
https://gitee.com/mirrors/CocoaPods-Specs
怎么改呢,直接在上面加一个码云的git地址,你要是觉得你的网好,你可以试试GitHub的。反正我是放弃了,这个太浪费我时间了。
之后,就慢慢等,它就会开始拉取代码,我们可以在这个目录看到拉取的项目
对了还会因为网不好出现这个错误:
[!] Error installing Folly
[!] /usr/local/bin/git clone https://github.com/facebook/folly.git /var/folders/_9/pc7kyd5n3fj700fn3f04knhm0000gn/T/d20200525-88019-dr8xzy --template= --single-branch --depth 1 --branch v2018.10.22.00
正克隆到 '/var/folders/_9/pc7kyd5n3fj700fn3f04knhm0000gn/T/d20200525-88019-dr8xzy'...
error: RPC 失败。curl 18 transfer closed with outstanding read data remaining
fatal: 远端意外挂断了
fatal: 过早的文件结束符(EOF)
fatal: index-pack 失败
没事,不断的重复就是了,不停的重复,直到结束。
allahbin@localhost ios % pod install
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)
Installing FBLazyVector (0.62.2)
Installing FBReactNativeSpec (0.62.2)
Installing Flipper (0.33.1)
Installing Flipper-DoubleConversion (1.1.7)
Installing Flipper-Folly (2.2.0)
Installing Flipper-Glog (0.3.6)
Installing Flipper-PeerTalk (0.0.4)
Installing Flipper-RSocket (1.1.0)
Installing FlipperKit (0.33.1)
Installing Folly (2018.10.22.00)
Installing OpenSSL-Universal (1.0.2.19)
Installing RCTRequired (0.62.2)
Installing RCTTypeSafety (0.62.2)
Installing React (0.62.2)
Installing React-Core (0.62.2)
Installing React-CoreModules (0.62.2)
Installing React-RCTActionSheet (0.62.2)
Installing React-RCTAnimation (0.62.2)
Installing React-RCTBlob (0.62.2)
Installing React-RCTImage (0.62.2)
Installing React-RCTLinking (0.62.2)
Installing React-RCTNetwork (0.62.2)
Installing React-RCTSettings (0.62.2)
Installing React-RCTText (0.62.2)
Installing React-RCTVibration (0.62.2)
Installing React-cxxreact (0.62.2)
Installing React-jsi (0.62.2)
Installing React-jsiexecutor (0.62.2)
Installing React-jsinspector (0.62.2)
Installing ReactCommon (0.62.2)
Installing Yoga (1.14.0)
Installing YogaKit (1.18.1)
Installing boost-for-react-native (1.63.0)
Installing glog (0.3.5)
Generating Pods project
Integrating client project
[!] Please close any current Xcode sessions and use `AwesomeProject.xcworkspace` for this project from now on.
Pod installation complete! There are 47 dependencies from the Podfile and 37 total pods installed.
然后就成功运行,可以愉快的玩耍了
2024年1月24日 更新
这次的问题比之前的还要奇怪,我以及在pod上配置了source了,但是在下载一些东西的时候,还是会去GitHub中下载,这显然是有问题的。
为此我选择使用代理的形式来解决这些问题。
首先,在终端配置代理
export https_proxy=http://localhost:4780
export http_proxy=http://localhost:4780
注意,即使是 HTTPS 代理,URL 也可能以 http:// 开头。
虽然现在很少有从http去下载东西的操作,但是还是加上吧。
配置完成后,需要进行检查
echo $https_proxy
然后我们就可以正常pod install了!!!