简体   繁体   English

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

[英]Ruby on rails openssl error when creating new project

I'm a newbie to Ruby and I've been going through the lynda.com ruby on rails essential program. 我是Ruby的新手,我一直在学习lynda.com ruby​​ on rails基本程序。

I'm using windows7 with ruby 2.0 and with rails 3.2.12 我正在将Windows7与ruby 2.0和rails 3.2.12一起使用

However when creating a ruby project I get this error. 但是,当创建一个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!

Can anyone help me out here. 有人可以帮我从这里出去吗。 I want to learn rails but I don't know what this is or what to do with it. 我想学习Rails,但我不知道这是什么或如何使用它。

This Error discribed here: http://amitkazmirsky.com/2013/01/03/installing-rails-with-mysql-on-windows-8 actually thereis a problem with sertificates that has a different solutions, try this: 将此错误描述在这里: http : //amitkazmirsky.com/2013/01/03/installing-rails-with-mysql-on-windows-8实际上,证书存在问题,并且解决方案不同,请尝试以下操作:

Fix SSL issues 修复SSL问题

“OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed” “ OpenSSL :: SSL :: SSLError:SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B:证书验证失败”

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

  2. Press WindowsKey+'x' then 'y' (system), choose “Advanced system settings” to the left. 按WindowsKey +“ x”,然后按“ y”(系统),选择左侧的“高级系统设置”。

  3. You are in the advance tab. 您在高级选项卡中。 Press “Environment Variables” button on the bottom. 按底部的“环境变量”按钮。

  4. In the “System Variables” section, add a new variable name “SSL_CERT_FILE”, value “C:\\RailsInstaller\\cacert.pem” 在“系统变量”部分,添加一个新的变量名称“ SSL_CERT_FILE”,值“ C:\\ RailsInstaller \\ cacert.pem”

If you look at the Gemfile generated by Rails, you see that is connecting to rubygems via SSL. 如果查看Rails生成的Gemfile,您会看到它通过SSL连接到rubygems。

source 'https://rubygems.org'

Simply change this line to 只需将此行更改为

source 'http://rubygems.org'

This is not a great idea in the long term or for a deployment system, but it can get you up and running while the issue is sorted out. 从长远来看或对于部署系统来说,这都不是一个好主意,但是在解决问题时,它可以使您正常运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM