关于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
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容