Ruby-on-rails 无法加载此类文件 -- openssl (LoadError)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14845481/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 21:24:30  来源:igfitidea点击:

cannot load such file -- openssl (LoadError)

ruby-on-railsrvm

提问by Bruno

In OS X in rvm how do I check if openssl is configured properly? I get the cannot load such file -- openssl (LoadError)And I have tried everything in Rails 3 - no such file to load -- opensslwith no success.

在 rvm 中的 OS X 中,如何检查 openssl 是否配置正确?我得到了cannot load such file -- openssl (LoadError)并且我已经尝试了Rails 3 中的所有内容- 没有加载这样的文件 - openssl没有成功。

回答by mpapis

Check what rubies are installed:

检查安装了哪些红宝石:

rvm list

Then make sure to use one of the installed rubies:

然后确保使用已安装的红宝石之一:

rvm use 1.9.3-p327

And test if opensslis available:

并测试是否openssl可用:

ruby -ropenssl -e "puts :OK"

It will print OKif opensslis enabled, otherwise you will get exception

OK如果openssl启用它会打印,否则你会得到异常

In case of exception =>

如果出现异常 =>

UPDATE:

更新:

new version of rvm has improved automation support:

新版 rvm 改进了自动化支持:

rvm get stable
rvm autolibs enable
rvm reinstall all --force

OLD:

老的:

run:

跑:

rvm requirements run force
rvm pkg remove

Followed by:

其次是:

rvm reinstall all --force

This instruction is not OSX specific, it will work on all platforms, although on OSX it will work best with HomeBrew, when it's not installed only list of required software will be shown and you need to install it manually.

此说明不是特定于 OSX 的,它适用于所有平台,尽管在 OSX 上它最适合与 HomeBrew 一起使用,当它没有安装时,只会显示所需软件的列表,您需要手动安装它。

回答by Bruno

I uninstalled everything (rvm, rails, ruby, etc) on my macbook.

我卸载了我的 macbook 上的所有东西(rvm、rails、ruby 等)。

Installed homebrew

安装自制软件

Installed rvm

安装 rvm

Ran rvm requirements run force

rvm requirements run force

Ran rvm install rails

rvm install rails

rails new sample_app

rails new sample_app

cd sample_app

cd sample_app

Note:source 'https://rubygems.org'is present in Gemfile, openssl is required!

注意:source 'https://rubygems.org'存在于 Gemfile 中,需要 openssl!

bundle installand it worked!

bundle install它奏效了

No need to specify:--with-openssl-dir=$HOME/.rvm/usr

无需指定:--with-openssl-dir=$HOME/.rvm/usr

回答by Agalya Loganathan

To resolve this, install openssl (preferably using brew).

要解决此问题,请安装 openssl(最好使用 brew)

Update Xcode to the latest version and enable command line installationsusing it.

将 Xcode 更新到最新版本并使用它启用命令行安装

Reinstall rvm using rvm reinstall all

使用 rvm重新安装rvm重新安装所有

Note that rvm reinstall all --forcewill delete all your previous installations of binaries/ pkgs done using rvm.

请注意,rvm 重新安装所有 --force将删除您之前使用 rvm 完成的所有二进制文件/ pkgs 安装。

回答by kjian

gem install openssl
worked for me, but nothing has declared depending on the openssl, its weired

gem install openssl
对我来说有效,但没有任何声明取决于 openssl,它很奇怪