安裝 json
gem的時(shí)候遇到報(bào)錯, 如下:
? gem install json -v '1.8.6' [ruby-2.5.1][21:12:28]
ERROR: Could not find a valid gem 'json' (= 1.8.6), here is why:
Unable to download data from https://gems.ruby-china.org - bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
這個問題出現(xiàn)在最近ruby-china更換了 gems.ruby-china的域 該網(wǎng)址不復(fù)存在.https://gems.ruby-china.org
使用新網(wǎng)址: https://gems.ruby-china.com.
在本地的環(huán)境下安裝gems需要重新執(zhí)行命令:
修改
~/.bundle/config
中的源鏈接-
執(zhí)行:
gem source -l
然后刪除多余的源鏈接gem sources -r https://gems.ruby-china.org
-
導(dǎo)入新的源鏈接
gem sources -a https://gems.ruby-china.com
然后執(zhí)行 json
gem的安裝.
? gem install json -v '1.8.6' [ruby-2.5.1][21:23:34]
Fetching: json-1.8.6.gem (100%)
Building native extensions. This could take a while...
Successfully installed json-1.8.6
WARNING: Unable to pull data from 'https://gems.ruby-china.org': bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
1 gem installed