React Native ios運(yùn)行報(bào)錯(cuò)

發(fā)現(xiàn)碼云的好像有點(diǎn)問(wèn)題,可以換成清華大學(xué)的試試:

https://mirrors.tuna.tsinghua.edu.cn/help/CocoaPods/

周末因?yàn)镸AC沒(méi)電,所以一直都沒(méi)折騰IOS的運(yùn)行。今天充電了就趕緊試一下。

結(jié)果,一運(yùn)行就報(bào)錯(cuò):

> 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:

上面寫(xiě)了,Did you run "pod install" in iOS directory,好吧,很聽(tīng)話的去ios目錄輸入了pod install

然后就報(bào)錯(cuò)。。。

太難了。。。

反正拿著那個(gè)錯(cuò)誤,大部分都是讓去改Podfile這個(gè)文件,也就是這個(gè)

截屏2020-05-25 下午4.56.46.png

https://gitee.com/mirrors/CocoaPods-Specs

怎么改呢,直接在上面加一個(gè)碼云的git地址,你要是覺(jué)得你的網(wǎng)好,你可以試試GitHub的。反正我是放棄了,這個(gè)太浪費(fèi)我時(shí)間了。

截屏2020-05-25 下午4.57.18.png

之后,就慢慢等,它就會(huì)開(kāi)始拉取代碼,我們可以在這個(gè)目錄看到拉取的項(xiàng)目


截屏2020-05-25 下午4.58.34.png

對(duì)了還會(huì)因?yàn)榫W(wǎng)不好出現(xiàn)這個(gè)錯(cuò)誤:

[!] 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: 遠(yuǎn)端意外掛斷了
fatal: 過(guò)早的文件結(jié)束符(EOF)
fatal: index-pack 失敗

沒(méi)事,不斷的重復(fù)就是了,不停的重復(fù),直到結(jié)束。

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.

然后就成功運(yùn)行,可以愉快的玩耍了

2024年1月24日 更新

這次的問(wèn)題比之前的還要奇怪,我以及在pod上配置了source了,但是在下載一些東西的時(shí)候,還是會(huì)去GitHub中下載,這顯然是有問(wèn)題的。

為此我選擇使用代理的形式來(lái)解決這些問(wèn)題。

首先,在終端配置代理

export https_proxy=http://localhost:4780
export http_proxy=http://localhost:4780

注意,即使是 HTTPS 代理,URL 也可能以 http:// 開(kāi)頭。

雖然現(xiàn)在很少有從http去下載東西的操作,但是還是加上吧。

配置完成后,需要進(jìn)行檢查

echo $https_proxy

然后我們就可以正常pod install了?。?!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容