创建新项目时Ruby on rails openssl错误

时间:2013-02-28 11:24:28

标签: ruby-on-rails ruby rubygems

我是Ruby的新手,我一直在浏览lynda.com ruby​​ on rails必备程序。

我正在使用带有ruby 2.0的windows7和使用rails 3.2.12

然而,在创建ruby项目时,我收到此错误。

         run  bundle install
E:/Ruby200/lib/ruby/2.0.0/net/http.rb:917:in `connect': SSL_connect returned=1 e
rrno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL
::SSL::SSLError)
        from E:/Ruby200/lib/ruby/2.0.0/net/http.rb:917:in `block in connect'
        from E:/Ruby200/lib/ruby/2.0.0/timeout.rb:51:in `timeout'
        from E:/Ruby200/lib/ruby/2.0.0/net/http.rb:917:in `connect'
        from E:/Ruby200/lib/ruby/2.0.0/net/http.rb:861:in `do_start'
        from E:/Ruby200/lib/ruby/2.0.0/net/http.rb:856:in `start'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/vendo
r/net/http/persistent.rb:628:in `start'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/vendo
r/net/http/persistent.rb:570:in `connection_for'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/vendo
r/net/http/persistent.rb:930:in `request'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/fetch
er.rb:195:in `fetch'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/fetch
er.rb:169:in `use_api'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/sourc
e/rubygems.rb:223:in `block in remote_specs'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/sourc
e/rubygems.rb:223:in `select'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/sourc
e/rubygems.rb:223:in `remote_specs'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/sourc
e/rubygems.rb:162:in `fetch_specs'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/sourc
e/rubygems.rb:66:in `specs'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/defin
ition.rb:192:in `block (2 levels) in index'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/defin
ition.rb:189:in `each'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/defin
ition.rb:189:in `block in index'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/index
.rb:9:in `build'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/defin
ition.rb:185:in `index'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/defin
ition.rb:179:in `resolve'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/defin
ition.rb:114:in `specs'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/defin
ition.rb:109:in `resolve_remotely!'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/insta
ller.rb:83:in `run'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/insta
ller.rb:14:in `install'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/cli.r
b:247:in `install'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/vendo
r/thor/task.rb:27:in `run'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/vendo
r/thor/invocation.rb:120:in `invoke_task'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/vendo
r/thor.rb:344:in `dispatch'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/vendo
r/thor/base.rb:434:in `start'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/bin/bundle:20:in
`block in <main>'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/lib/bundler/frien
dly_errors.rb:4:in `with_friendly_errors'
        from E:/Ruby200/lib/ruby/gems/2.0.0/gems/bundler-1.3.0/bin/bundle:20:in
`<main>'
        Unfortunately, a fatal error has occurred. Please see the Bundler
        troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!

任何人都可以帮助我。我想学习铁轨,但我不知道这是什么或者用它做什么。

2 个答案:

答案 0 :(得分:0)

此错误在此处描述:http://amitkazmirsky.com/2013/01/03/installing-rails-with-mysql-on-windows-8 实际上有一个有不同解决方案的证书有问题,试试这个:

修复SSL问题

“OpenSSL :: SSL :: SSLError:SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B:证书验证失败”

  1. http://curl.haxx.se/ca/cacert.pem下载到“C:\ RailsInstaller \”

  2. 按WindowsKey +'x'然后按'y'(系统),选择左侧的“高级系统设置”。

  3. 您处于高级选项卡中。按底部的“环境变量”按钮。

  4. 在“系统变量”部分中,添加一个新变量名“SSL_CERT_FILE”,值“C:\ RailsInstaller \ cacert.pem”

答案 1 :(得分:0)

如果查看Rails生成的Gemfile,您会看到通过SSL连接到rubygems。

source 'https://rubygems.org'

只需将此行更改为

即可

source 'http://rubygems.org'

从长远来看,这不是一个好主意,也不适用于部署系统,但它可以帮助您解决问题。