我剛剛安裝了ruby,並且一直在關注Ruby教程。我開始這個教程:https://www.distilled.net/resources/web-scraping-with-ruby-and-nokogiri-for-beginners/Ruby,HTTParty,SSL錯誤
在那裏我得到了SSL錯誤,所以我使用的指南在http://guides.rubygems.org/ssl-certificate-update/
我的問題是,雖然,我的版本是2.6.7紅寶石當我問的版本,但是當我運行這個代碼:
require 'Nokogiri'
require 'HTTParty'
require 'JSON'
require 'Pry'
require 'csv'
page = HTTParty.get('https://google.com/')
Pry.start(binding)
我得到這個錯誤
C:\Ruby22\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/Users/Tom/RubymineProjects/projectone/projectone.rb
C:/Ruby22/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:923:in `block in connect'
from C:/Ruby22/lib/ruby/2.2.0/timeout.rb:73:in `timeout'
from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:923:in `connect'
from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:863:in `do_start'
from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:852:in `start'
from C:/Ruby22/lib/ruby/2.2.0/net/http.rb:1375:in `request'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/httparty-0.14.0/lib/httparty/request.rb:118:in `perform'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/httparty-0.14.0/lib/HTTParty.rb:560:in `perform_request'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/httparty-0.14.0/lib/HTTParty.rb:486:in `get'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/httparty-0.14.0/lib/HTTParty.rb:598:in `get'
from C:/Users/Tom/RubymineProjects/projectone/projectone.rb:7:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
這似乎是使用2.2.0,我仍然試圖谷歌如何卸載一個版本,但STIL我不確定該怎麼做?任何幫助?
我在Ruby Mine中運行腳本(如果有幫助的話)。
我運行Windows 10
紅寶石的當前穩定版本是'2.3.3' ......沒有紅寶石'2.6.7' – FeifanZ
爲了澄清,'寶石-v'爲2.6 .7和'ruby -v'是2.2? – orde
'SSL_connect'錯誤意味着它連接到服務器,但服務器沒有響應有效的SSL證書。你應該確定爲什麼是這種情況......也許你的網絡配置中有一些東西? – FeifanZ