新手问题 小白添加 gem 源始终报错,无法添加,该怎么破?

xiaorui · 2015年10月26日 · 最后由 zoker 回复于 2015年10月27日 · 4892 次阅读

在 centos 上添加淘宝的源,始终是报错,不知道该怎么处理了。各位大神给解解。

[root@CentOS etc]# gem sources --add https://ruby.taobao.org/ Error fetching https://ruby.taobao.org/: Errno::ETIMEDOUT: Connection timed out - connect(2) for "ruby.taobao.org" port 443 (https://ruby.taobao.org/specs.4.8.gz)

https://ruby.taobao.org/, 进去看看?目前访问应该没问题才对

#2 楼 @xiaorui 照里面的命令做都不行?那你得找找网络问题了

#4 楼 @easonlovewan 尝试 ping ruby.taobao.org 可以 ping 通。

[root@CentOS etc]# ping ruby.taobao.org PING ruby.taobao.org (223.6.253.37) 56(84) bytes of data. 64 bytes from 223.6.253.37: icmp_seq=1 ttl=33 time=60.4 ms 64 bytes from 223.6.253.37: icmp_seq=2 ttl=33 time=57.3 ms 64 bytes from 223.6.253.37: icmp_seq=3 ttl=33 time=57.8 ms 64 bytes from 223.6.253.37: icmp_seq=4 ttl=33 time=57.4 ms 64 bytes from 223.6.253.37: icmp_seq=5 ttl=33 time=59.7 ms 64 bytes from 223.6.253.37: icmp_seq=6 ttl=33 time=57.4 ms 64 bytes from 223.6.253.37: icmp_seq=7 ttl=33 time=57.4 ms

#4 楼 @easonlovewan #3 楼 @alphaliu

尝试 ping ruby.taobao.org 可以 ping 通。

[root@CentOS etc]# ping ruby.taobao.org PING ruby.taobao.org (223.6.253.37) 56(84) bytes of data. 64 bytes from 223.6.253.37: icmp_seq=1 ttl=33 time=60.4 ms 64 bytes from 223.6.253.37: icmp_seq=2 ttl=33 time=57.3 ms 64 bytes from 223.6.253.37: icmp_seq=3 ttl=33 time=57.8 ms 64 bytes from 223.6.253.37: icmp_seq=4 ttl=33 time=57.4 ms 64 bytes from 223.6.253.37: icmp_seq=5 ttl=33 time=59.7 ms 64 bytes from 223.6.253.37: icmp_seq=6 ttl=33 time=57.4 ms 64 bytes from 223.6.253.37: icmp_seq=7 ttl=33 time=57.4 ms

curl https://ruby.taobao.org

测一下外网 443 端口是否通的?

#7 楼 @huacnlee curl https://ruby.taobao.org执行之后,显示的是页面源码,这样对吗?

在服务器上执行 gem install rails -V 试试

#9 楼 @huacnlee 报错如下,提示没有源 [root@CentOS etc]# gem install rails -V ERROR: Could not find a valid gem 'rails' (>= 0) in any repository

这台服务器是在内网,通过 nat 上网,这个有直接些影响吗?

这个命令是什么结果? curl -LI https://ruby.taobao.org/specs.4.8.gz

以前的公司把 ruby.taobao.org 屏蔽了,因为域名里面有淘宝字样,不过你应该不是这种情况。

#12 楼 @qhwa

执行后 [root@CentOS ~]# curl -LI https://ruby.taobao.org/specs.4.8.gz HTTP/1.1 302 Moved Temporarily Server: nginx/1.4.7 Date: Tue, 27 Oct 2015 03:36:23 GMT Content-Type: text/html Content-Length: 160 Connection: keep-alive Location: https://rubygems-china.oss-cn-hangzhou.aliyuncs.com/specs.4.8.gz

HTTP/1.1 200 OK Server: AliyunOSS Date: Tue, 27 Oct 2015 03:36:29 GMT Content-Type: application/gzip Content-Length: 2585617 Connection: keep-alive x-oss-request-id: 562EF13DB295346D4CF15B4F Accept-Ranges: bytes ETag: "43C7E162D73A0E192DDB4770903E3245" Last-Modified: Tue, 27 Oct 2015 03:31:21 GMT x-oss-object-type: Normal

我遇到过这种问题,用户 https 能访问,但是通过终端始终是超时,这是因为我们用了高仿 IP 的原因

但,ruby.taobao.org 应该没用吧

需要 登录 后方可回复, 如果你还没有账号请 注册新账号