无法在ruby中需要openssl [英] Couldn't require openssl in ruby

查看:139
本文介绍了无法在ruby中需要openssl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的虚拟机ubuntu12.04lts中安装了openssl。



当我运行gem命令时,它会给出错误信息。


错误:执行gem(Gem :: Exception)时
无法要求openssl。安装openSSL并重新构建ruby(首选)或使用非HTTPs资源


我还测试了在irb模式下需要openssl。
它给出错误。


Loaderror:无法加载这样的文件--openssl

from / usr / local / lib / ruby​​ / site_ruby / 2.1.0 / ruby​​gems / core_ext / kernel_require.rb:55`require'

  $ openssl版本
OpenSSL 1.0.1 2012年3月14日

如何解决这个错误?

解决方案

对rubygems.org的调用已被废弃 - 请谨慎操作!



在从源代码构建ruby2.1.0p0之后,我在Mac OSX上遇到了同样的问题。我已经安装了openssl。看起来,宝石中的参考需要令人耳目一新。我跑了:



gem source -r https://rubygems.org/ 删除



后跟

宝石来源-a https://rubygems.org/阅读



在此之后,我能够成功运行 gems install bundler



如果遇到更多错误,可以尝试 ./ configure --with-openssl-dir = / usr / local / ssl 在你的ruby下载dir /。


I have openssl installed in my virtual machine ubuntu12.04lts.

When I run the gem command it gives error.

Error: while executing gem (Gem::Exception)
Unable to require openssl. install openSSL and rebuilt ruby (preferred) or use non HTTPs sources

And I also test require openssl in irb mode. it gives error.

Loaderror: cannot load such file --openssl
from /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55 `require'

I have openssl

$openssl version
OpenSSL 1.0.1 14 mar 2012

How to fix the error?

解决方案

Note: Calls to rubygems.org are deprecated - proceed with caution!

I had the same issue on Mac OSX after also building ruby2.1.0p0 from the source. I already had openssl installed. It appears that the reference in gems needed refreshing. I ran:

gem source -r https://rubygems.org/ to remove

followed by

gem source -a https://rubygems.org/ to read

After this, I was able to run gems install bundler successfully.

If you run into further errors, you can try ./configure --with-openssl-dir=/usr/local/ssl in your ruby downloaded dir/.

这篇关于无法在ruby中需要openssl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆