在Mac上配置flutter環(huán)境時(shí)出現(xiàn)了這個(gè)問題(當(dāng)費(fèi)勁九牛二虎只力把mac os和Xcode都升級(jí)到最新后福荸。我的心情時(shí)奔潰的)
我使用的Android Studio蕴坪,萬事具備的時(shí)候運(yùn)行flutter ?doctor 出現(xiàn)了下面的異常:
按照提示安裝cocoapods,在終端運(yùn)行?sudo gem install cocoapods時(shí)敬锐,又出現(xiàn)了這篇文章出現(xiàn)的原因:
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data fromhttps://ruby.taobao.org/- bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
己經(jīng)百度查閱和試探各種方法都無果背传。。台夺。
現(xiàn)將解決辦法分享給大家:
打開mac終端径玖,替換ruby-china鏡像
192:~ mac$ gem sources --remove https://rubygems.org/
source https://rubygems.org/ not present in cache
192:~ mac$ gem sources --remove https://ruby.taobao.org/
source https://ruby.taobao.org/ not present in cache
192:~ mac$ gem sources -a https://gems.ruby-china.com/
https://gems.ruby-china.com/ added to sources
驗(yàn)證你的ruby鏡像是不是ruby-china
192:~ mac$ gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.com/
192:~ mac$ sudi gem update --system
-bash: sudi: command not found
192:~ mac$ sudo gem update --system
Password:
Latest version already installed. Done.
安裝最新版本的 cocoapods
192:~ mac$? sudo gem install -n /usr/local/bin cocoapods
Fetching ffi-1.12.2.gem
Successfully installed thread_safe-0.3.6
.
.
.
Installing ri documentation for cocoapods-1.9.1
Done installing documentation for thread_safe, tzinfo, concurrent-ruby, i18n, activesupport, nap, fuzzy_match, httpclient, algoliasearch, ffi, ethon, typhoeus, netrc, cocoapods-core, claide, cocoapods-deintegrate, cocoapods-downloader, cocoapods-plugins, cocoapods-search, cocoapods-stats, cocoapods-trunk, cocoapods-try, molinillo, atomos, colored2, nanaimo, xcodeproj, escape, fourflusher, gh_inspector, ruby-macho, cocoapods after 56 seconds
32 gems installed
成功~~