ruby 淘宝镜像

(安装好Ruby后在命令行的操作在各个系统下的操作完全一致) 
由于国内网络原因,导致 rubygems.org 存放在 Amazon S3 上面的资源文件间歇性连接失败。所以会与遇到 gem install rack 或 bundle install 的时候半天没有响应;故此解决办法如下:

首先移除掉rubygems.org

<code class="hljs oxygene has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">gem sources --<span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">remove</span> https:<span class="hljs-comment" style="color: rgb(136, 0, 0); box-sizing: border-box;">//rubygems.org/</span></code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

然后换用淘宝镜源

<code class="hljs livecodeserver has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">gem sources -<span class="hljs-operator" style="box-sizing: border-box;">a</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">https</span>://ruby.taobao.org/</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

出现错误提示如下

<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">Error fetching https://ruby<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.taobao</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.org</span>/:  
        SSL_connect returned=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">1</span> errno=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0</span> state=SSLv3 read server certificate B: certificate verify failed (https://rubygems-china<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.oss</span>-cn-hangzhou<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.aliyuncs</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.com</span>/specs<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.4</span><span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">.8</span><span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.gz</span>) </code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li></ul>

发现原来是taobao Gems 源已停止维护,现由 ruby-china 提供镜像服务,即我们要换源:http://gems.ruby-china.org/

<code class="hljs livecodeserver has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">gem sources -<span class="hljs-operator" style="box-sizing: border-box;">a</span> <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">http</span>://gems.ruby-china.org/</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li></ul>

注意:这里是http而不是https,如果你发现出错了,请检查下这里。

安装好后用gem sources -l检查当前SOURCES列表:

<code class="hljs avrasm has-numbering" style="display: block; padding: 0px; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal; background: transparent;">*** CURRENT SOURCES ***

<span class="hljs-label" style="box-sizing: border-box;">http:</span>//gems<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.ruby</span>-china<span class="hljs-preprocessor" style="color: rgb(68, 68, 68); box-sizing: border-box;">.org</span>/</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right-width: 1px; border-right-style: solid; border-right-color: rgb(221, 221, 221); list-style: none; text-align: right; background-color: rgb(238, 238, 238);"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值