【開發筆記】gem添加國內的源

一個開源項目引用了一大堆的框架,install的時候碰到了問題,最後才發現是gem的源的問題,gem的源也是換來換去的,不過最後也是終於搞定了。

Ruby gem添加國內的源(新地址)

刪除默認的的鏡像源,添加國內最新的鏡像源(淘寶的那個已經不再維護)

$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/ 

查看源的指令:

// 查看所有源
$ gem sources -l

// 如果出現
> *** CURRENT SOURCES ***
> 
> https://gems.ruby-china.com/

// 就說明OK了

更新緩存:

// 更新緩存
$ gem sources -u 

其中一定要注意,淘寶的那個源不再維護了,ruby-china的源的後綴是.com,而不是.org,否則會報錯:

$ gem sources -a https://gems.ruby-china.org/
Error fetching https://gems.ruby-china.org/:
bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
majialundeMacBook:trust-wallet-ios majialun$ gem sources --add https://gems.ruby-china.org/
Error fetching https://gems.ruby-china.org/:
bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
majialundeMacBook:trust-wallet-ios majialun$ gem sources --add https://gems.ruby-china.org/

使用org地址會報錯:bad response Not Found 404。

關於gem

官網地址:

https://rubygems.org/
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章