2016-07-07 184 views
2

我正在嘗試安裝寶石gem install micromidi。每當我從終端運行它,我收到此錯誤:拒絕連接RubyGems

ERROR: Could not find a valid gem 'micromidi' (>= 0), here is why: 
      Unable to download data from https://rubygems.org/ - Errno::ECONNREFUSED: Connection refused - connect(2) for "rubygems.global.ssl.fastly.net" port 443 (https://api.rubygems.org/latest_specs.4.8.gz) 

我不是在代理後面,我有互聯網連接。我以前安裝過寶石,並且從未遇到過問題。怎麼了,我該如何解決這個問題?

+0

你用'gem install micromidi --debug --backtrace --verbose'得到了什麼? – treiff

+0

你想具體做什麼?整個堆棧跟蹤?它太大而無法完整發布。 – jason328

回答

3

還有的是關於SSL和提「快速度」提交的最近的一些合併,該搜索回購的,如:https://github.com/rubygems/rubygems/search?o=desc&q=fastly&s=created&type=Issues

此外,2.6.3/2016-04-05 […] New fastly cert. Pull request #1548 by David Radcliffe看到:https://github.com/rubygems/rubygems/blob/ccb9c3300c063f5b5656669972d24a10ef8afbf5/History.txt#L63


ANSWER

我推薦手動更新到RubyGems的v2.6.6 - 2016年6月22日,通過https://rubygems.org/pages/download

If you don't have any RubyGems installed, there is still the pre-gem approach to getting software, doing it manually:

  1. Download from above
  2. Unpack into a directory and cd there
  3. Install with: ruby setup.rb (you may need admin/root privilege)

資源

如果上述不能解決問題,這裏有一些額外的資源:

Step 1: Obtain the new trust certificate

[…]

We need to download AddTrustExternalCARoot-2048.pem[ https://raw.githubusercontent.com/rubygems/rubygems/master/lib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem ]

Use the above link and place/save this file somewhere you can later find easily (eg. your Desktop).

IMPORTANT: File must have .pem as extension. Browsers like Chrome will try to save it as plain text file. Ensure you change the filename to have .pem in it after you have downloaded it.

Step 2: Locate RubyGems certificate directory in your installation

In order for us copy this file, we need to know where to put it.

Depending on where you installed Ruby, the directory will be different.

Take for example the default installation of Ruby 2.1.5, placed in C:\Ruby21

Open a Command Prompt and type in:

C:\>gem which ruby gems 
C:/Ruby21/lib/ruby/2.1.0/rubygems.rb 

Now, let's locate that directory. From within the same window, enter the path part up to the file extension, but using backslashes instead:

C:\>start C:\Ruby21\lib\ruby\2.1.0\rubygems 

This will open a Explorer window inside the directory we indicated.

Step 3: Copy new trust certificate

Now, locate ssl_certs directory and copy the .pem file we obtained from previous step inside.

It will be listed with other files like GeoTrustGlobalCA.pem .

+1

完美..謝謝 – mtk