问题描述
我的虚拟机 ubuntu12.04lts 中安装了 openssl.
I have openssl installed in my virtual machine ubuntu12.04lts.
当我运行 gem 命令时,它会出错.
When I run the gem command it gives error.
错误:执行 gem 时 (Gem::Exception)
无法要求 openssl.安装 openSSL 并重建 ruby(首选)或使用非 HTTPs 源
而且我还在 irb 模式下测试了 require openssl.它给出了错误.
And I also test require openssl in irb mode.it gives error.
加载错误:无法加载此类文件--openssl
来自/usr/local/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55 `require'
我有 openssl
$openssl version
OpenSSL 1.0.1 14 mar 2012
如何修复错误?
推荐答案
注意:不推荐调用 rubygems.org - 谨慎操作!
Note: Calls to rubygems.org are deprecated - proceed with caution!
在从源代码构建 ruby2.1.0p0 之后,我在 Mac OSX 上遇到了同样的问题.我已经安装了openssl.看来 gems 中的引用需要刷新.我跑了:
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/
删除
关注
gem source -a https://rubygems.org/
阅读
在此之后,我能够成功运行gems install bundler
.
After this, I was able to run gems install bundler
successfully.
如果您遇到更多错误,您可以在您的 ruby 下载目录中尝试 ./configure --with-openssl-dir=/usr/local/ssl
.
If you run into further errors, you can try ./configure --with-openssl-dir=/usr/local/ssl
in your ruby downloaded dir/.
这篇关于无法在 ruby 中要求 openssl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!