• ERROR: While executing gem … (Gem::RemoteFetcher::FetchError)


    原文地址:https://www.zfanw.com/blog/error-while-executing-gem-gem-remote-fetch-error.html

    我对命令行下安装 gem 包或是 npm 包有很大的心理阴影,因为出现无法​安装的概率实在太大了 – 每次都要破口大骂 gfw。

    这一回是在更新 gem 时:

    gem update --system
    

    返回的错误如下:

    ERROR: While executing gem … (Gem::RemoteFetcher::FetchError)

    Errno::ETIMEDOUT: Operation timed out – connect(2) for “s3.amazonaws.com” port 443 (https://api.rubygems.org/specs.4.8.gz)

    出现 s3 的地址是因为此前 https://rubygems.org 源地址不行,所以执行了 gem source 添加源库:

    gem source --add https://s3.amazonaws.com/production.s3.rubygems.org/
    

    如你所见,还是报错。

    查了资料,不巧 StackOverflow 上这个问题提到了 Proxy,我国的国情,不挂代理简直混不下去 IT 业,所以我的 Mac OSX 的代理环境是这样的:

    privoxy(http://localhost:8118) -> sslEdge(http://localhost:100010)全局
    

    Privoxy 我是用来去除一些广告。且把死马当活马医吧:

    export http_proxy=http://localhost:8118
    export https_proxy=http://localhost:8118 
    gem update --system
    

    然后目瞪口呆:

    Updating rubygems-update
    Fetching: rubygems-update-2.4.7.gem (100%)
    Successfully installed rubygems-update-2.4.7
    Parsing documentation for rubygems-update-2.4.7
    Installing ri documentation for rubygems-update-2.4.7
    Installing darkfish documentation for rubygems-update-2.4.7
    Done installing documentation for rubygems-update after 2 seconds
    Installing RubyGems 2.4.7
    RubyGems 2.4.7 installed
    Parsing documentation for rubygems-2.4.7
    Installing ri documentation for rubygems-2.4.7
    

    竟然真是代理的问题。所以我猜想是 iterm2 不支持 socks 代理,因此全局并未生效。而通过 Privoxy 的 HTTP 代理做一次转发,就正常了 – 所以,还是 gfw 的问题。

  • 相关阅读:
    Netflix Ribbon(负载均衡)介绍
    Annotation 注解
    框架设计的灵魂-反射
    idea maven java.lang.outofmemoryerror gc overhead limit exceeded
    洛谷P4427 [BJOI2018]求和
    洛谷P1196 [NOI2002]银河英雄传说
    CF191C Fools and Roads
    洛谷P2296 寻找道路
    洛谷P3389 【模板】高斯消元法
    洛谷P1351 联合权值
  • 原文地址:https://www.cnblogs.com/AloneSword/p/5048447.html
Copyright © 2020-2023  润新知