关于gems.ruby-china.org地址更换导致的问题

安装 json gem的时候遇到报错, 如下:

» 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)

这个问题出现在最近ruby-china更换了 gems.ruby-china的域 https://gems.ruby-china.org 该网址不复存在.
使用新网址: https://gems.ruby-china.com.
在本地的环境下安装gems需要重新执行命令:

  1. 修改~/.bundle/config中的源链接

  2. 执行: gem source -l 然后删除多余的源链接

    gem sources -r https://gems.ruby-china.org
    
  3. 导入新的源链接

    gem sources -a https://gems.ruby-china.com
    

然后执行 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

你可能感兴趣的:(关于gems.ruby-china.org地址更换导致的问题)