ruby 淘宝镜像

来源:互联网 发布:unity3d官方视频教程 编辑:程序博客网 时间:2024/05/15 23:52

(安装好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
原创粉丝点击