1. 程式人生 > 實用技巧 >[!] CDN: trunk Repo update failed

[!] CDN: trunk Repo update failed

https://www.jianshu.com/p/bf1cbe49cb5d

由於專案是用CocoaPods管理,CocoaPods 1.8將CDN切換為預設的spec repo源,並附帶一些增強功能!CDN支援最初是在1.7版本中引入的,最終在1.7.2中完成。 它旨在大大加快初始設定和依賴性分析。

目前專案使用pods的是1.8.4版本

Ribers-Mac:ZNB_Country2.0 Riber$ pod --version 
1.8.4

最近使用pods,卻出現了一下錯誤!

[!] CDN: trunk Repo update failed - 17 error(s):
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/1/d/4/CocoaAsyncSocket/0.0.1/CocoaAsyncSocket.podspec.json, error: Operation timed out - SSL_connect
...

按照官方文件 podfile檔案中新增source源:
source 'https://github.com/CocoaPods/Specs.git'
podfile檔案中新增source源後,pod installpod update可以正常操作,但是pod search有些庫卻不正常。

Ribers-Mac:ZNB_Country2.0 Riber$ pod search mj
[!] CDN: trunk Repo update failed - 3 error(s):
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/0/f/b/MJRefresh/0.0.1/MJRefresh.podspec.json, error: Operation timed out - SSL_connect
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/0/f/b/MJRefresh/1.4.4/MJRefresh.podspec.json, error: Operation timed out - SSL_connect
CDN: trunk URL couldn't be downloaded: https://raw.githubusercontent.com/CocoaPods/Specs/master/Specs/0/f/b/MJRefresh/2.4.9/MJRefresh.podspec.json, error: Operation timed out - SSL_connect

Ribers-Mac:ZNB_Country2.0 Riber$ pod search rbtitle
-> RBTitleView (2.0.1)
   簡單實用的titleView
   pod 'RBTitleView', '~> 2.0.1'
   - Homepage: https://github.com/RiberWang/RBTitleDemo
   - Source:   https://github.com/RiberWang/RBTitleDemo.git
   - Versions: 2.0.1, 1.0.1, 1.0.0 [master repo]

解決辦法:

1. podfile檔案中指定source源為master:

source 'https://github.com/CocoaPods/Specs.git'

2.執行pod repo remove trunk移除trunk源

執行完後,pod search就都正常了!

Ribers-Mac:ZNB_Country2.0 Riber$ pod repo list

master
- Type: git (master)
- URL:  https://github.com/CocoaPods/Specs.git
- Path: /Users/Riber/.cocoapods/repos/master

trunk
- Type: CDN
- URL:  https://cdn.cocoapods.org/
- Path: /Users/Riber/.cocoapods/repos/trunk

2 repos
Ribers-Mac:ZNB_Country2.0 Riber$ pod repo remove trunk
Removing spec repo `trunk`
注意:podfile檔案中一定要指定master源,因為現在預設是trunk

source 'https://github.com/CocoaPods/Specs.git'

參考文章:
  1. 官方說明(英語不好的同志可在谷歌瀏覽器中開啟使用其翻譯功能)
  2. Github Issules


作者:RiberWang
連結:https://www.jianshu.com/p/bf1cbe49cb5d
來源:簡書
著作權歸作者所有。商業轉載請聯絡作者獲得授權,非商業轉載請註明出處。