react native 0.6x 在創(chuàng)建項(xiàng)目時(shí),CocoaPods 的依賴安裝步驟卡解決方案
前言
你需要做兩件事
gem換源
pod repo 換源
實(shí)戰(zhàn)
如果你已經(jīng)成功安裝了CocoaPods。那么這里你需要卸載它。
gem換源
1、 卸載CocoaPods
查看gem安裝的東西
gem list
下面一般就是gem安裝的一些依賴。
*** LOCAL GEMS ***
activesupport (4.2.11.1)
atomos (0.1.3)
bigdecimal (1.2.8)
CFPropertyList (3.0.1, 2.2.8)
claide (1.0.3)
cocoapods (1.7.5)
cocoapods-core (1.7.5)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.2.2)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.4.0)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.1.5)
did_you_mean (1.0.0)
escape (0.0.4)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
i18n (0.9.5)
io-console (0.4.5)
json (1.8.3.1)
libxml-ruby (2.9.0)
minitest (5.8.5)
molinillo (0.6.6)
nanaimo (0.2.6)
nap (1.1.0)
net-telnet (0.1.1)
netrc (0.11.0)
nokogiri (1.5.6)
power_assert (0.2.6)
psych (2.1.0.1)
rake (10.4.2)
rdoc (4.2.1)
ruby-macho (1.4.0)
sqlite3 (1.3.11)
test-unit (3.1.5)
thread_safe (0.3.6)
tzinfo (1.2.5)
xcodeproj (1.12.0)
我們需要做的就是把關(guān)于cocoapods的依賴全刪除(也就是有cocoapods字段的依賴)。
下面我只是列舉了兩個(gè)依賴,你可以在后面繼續(xù)加字段,注意要有空格哦!
sudo gem uninstall cocoapods cocoapods-core
然后你需要再查看是否刪除成功
gem list
2、gem更改源
gem update --system
刪除原來的源,添加國內(nèi)的源。
gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
查看源是否更改成功
gem sources -l
如果顯示https://gems.ruby-china.com說明更改成功,確保是有這一個(gè)源。
3、安裝cocoapods
sudo gem install cocoapods
啟動(dòng)
pod setup
pod repo 換源
1、查看當(dāng)前源
pod repo
2、添加新的源
切換到目錄
cd ~/.cocoapods/repos
刪除舊版的master
pod repo remove master
克隆指定源
git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master
再次查看源,保證只有剛才克隆的那一個(gè)repos,多余的執(zhí)行pod repo remove 名字即可。
vam@MacBook-Pro ~ % pod repo
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin19/rbconfig.rb:229: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
master
- Type: git (master)
- URL: https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
- Path: /Users/vam/.cocoapods/repos/master
1 repo
結(jié)語
一般執(zhí)行完這兩步,就可以輕輕松松的啟動(dòng)項(xiàng)目了。
作者:Vam的金豆之路
主要領(lǐng)域:前端開發(fā)
我的微信:maomin9761
微信公眾號(hào):前端歷劫之路