Ruby,windows 平台中的 'gem install Blunder' 错误

Ruby, Error in 'gem install Blunder' in windows platform

我正在尝试安装 Blunder。

gem install Blunder

但我遇到了这个错误

ERROR:  Could not find a valid gem 'bundler' (>= 0), here is why:
      Unable to download data from https://rubygems.org/ - Errno::ECONNREFUSED: Failed to open TCP connection to 127.0.0.1:1080 (No connection could be made because the target machine actively refused it. - connect(2) for "127.0.0.1" port 1080) (https://rubygems.org/specs.4.8.gz)

我尝试从这个 url (Error installing Bundler) 修复它,但注意到已解决。

更多详情:

我可以访问“https://rubygems.org/”url。 (不使用任何代理。)

我可以下载“https://rubygems.org/specs.4.8.gz”

我通过一些 VPN 连接进行连接,但我遇到了同样的错误。

我测试了更新命令。但是我得到了这个错误

gem install rubygems-update

C:\Windows\System32>gem update --system
ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
    Errno::ECONNREFUSED: Failed to open TCP connection to 127.0.0.1:1080 (No connection could be made because the target machine actively refused it. - connect(2) for "127.0.0.1" port 1080) (https://rubygems.org/specs.4.8.gz)

我测试了一些其他 gem 安装命令,例如

gem update --system
gem install installer


C:\Windows\System32>gem install installer
ERROR:  Could not find a valid gem 'installer' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - Errno::ECONNREFUSED: Failed to open TCP connection to 127.0.0.1:1080 (No connection could be made because the target machine actively refused it. - connect(2) for "127.0.0.1" port 1080) (https://rubygems.org/specs.4.8.gz)

C:\Windows\System32> gem install rubygems-update
ERROR:  Could not find a valid gem 'rubygems-update' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - Errno::ECONNREFUSED: Failed to open TCP connection to 127.0.0.1:1080 (No connection could be made because the target machine actively refused it. - connect(2) for "127.0.0.1" port 1080) (https://rubygems.org/specs.4.8.gz)

“gem sources -a http://rubygems.org”命令的结果。

C:\WINDOWS\system32>gem sources -a http://rubygems.org
https://rubygems.org is recommended for security over http://rubygems.org

Do you want to add this insecure source? [yn]  y
http://rubygems.org is too similar to https://rubygems.org

Do you want to add this source? [yn]  y
Error fetching http://rubygems.org:
        Errno::ECONNREFUSED: Failed to open TCP connection to 127.0.0.1:1080 (No connection could be made because the target machine actively refused it. - connect(2) for "127.0.0.1" port 1080) (http://rubygems.org/specs.4.8.gz)

“gem sources -r https://rubygems.org -a http://rubygems.org”命令的结果。

C:\WINDOWS\system32>gem sources -r https://rubygems.org -a http://rubygems.org
https://rubygems.org is recommended for security over http://rubygems.org

Do you want to add this insecure source? [yn]
https://rubygems.org is recommended for security over http://rubygems.org

Do you want to add this insecure source? [yn]  y
http://rubygems.org is too similar to https://rubygems.org

Do you want to add this source? [yn]  y
Error fetching http://rubygems.org:
        Errno::ECONNREFUSED: Failed to open TCP connection to 127.0.0.1:1080 (No connection could be made because the target machine actively refused it. - connect(2) for "127.0.0.1" port 1080) (http://rubygems.org/specs.4.8.gz)

我安装了 Ruby 2.7.1-1-x64 的最新版本 安装后我 运行 'ridk install' 设置 MSY2 ..... 但我看到一个错误

gpg: refreshing 8 keys from hkps://hkps.pool.sks-keyservers.net
gpg: keyserver refresh failed: General error
==> ERROR: A specified local key could not be updated from a keyserver.

此外,在“C:\Ruby26-x64\lib\ruby.6.0\win32\registry.rb”文件中。我将本地编码设置为

本地化 = Encoding.find(Encoding.locale_charmap)

本地化 = Encoding::UTF_8


感谢您的帮助。

我在 Internet Explorer 的“配置代理服务器”中将代理设置为 127.0.0.1:1080。 然后我使用了像 Ultra-surfe 这样的代理应用程序并将其端口设置为 1080。最后 "gem install bundler" 命令成功了。

现在,我的问题是:为什么 Ruby 尝试从代理端口连接到它的服务器??! 我通过此代码从命令行检查了代理

netsh winhttp show proxy

我也重置了代理

netsh winhttp show proxy

但是 Ruby“gem 安装”的命令仍然通过 127.0.0.1:1080 寻找打开 TCP 连接。为什么???我的系统有问题吗?

我确定这不是我系统的问题,因为 "npm install ..." 命令工作正常。例如这个命令

npm install touch-cli -g

我正在搜索这个问题,也许我会在一个新的 post 中提出我的新问题。