简体   繁体   English

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

[英]cannot load such file -- openssl (LoadError)

In OS X in rvm how do I check if openssl is configured properly?在 rvm 的 OS X 中,如何检查 openssl 是否配置正确? I get the cannot load such file -- openssl (LoadError) And I have tried everything in Rails 3 - no such file to load -- openssl with no success.我得到了cannot load such file -- openssl (LoadError)而且我已经尝试了Rails 3 中的所有内容-没有要加载的此类文件--openssl 没有成功。

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 openssl is available:并测试openssl是否可用:

ruby -ropenssl -e "puts :OK"

It will print OK if openssl is enabled, otherwise you will get exception如果启用openssl ,它将打印OK ,否则会出现异常

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,当它未安装时,只会显示所需软件的列表,您需要手动安装它。

Many years later, the solution is changed because of brew upgrading, this works now:多年后,由于 brew 升级,解决方案发生了变化,现在可以使用:

# pull full brew git repo
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow

# generate new brew tap repo
brew tap-new $USER/old-openssl

# extract openssl 1.0.2t forumlar to $USER/old-openssl
brew extract --version=1.0.2t openssl $USER/old-openssl

# install old openssl from $USER/old-openssl repo
brew install openssl@1.0.2t

# reinstall ruby
rvm reinstall 2.3.4 --with-openssl-dir=`brew --prefix openssl@1.0.2t`

尝试这个。

rvm install ruby-2.0.0-preview1  --with-openssl-dir=$HOME/.rvm/usr --verify-downloads 1

I uninstalled everything (rvm, rails, ruby, etc) on my macbook.我卸载了我的 macbook 上的所有东西(rvm、rails、ruby 等)。

Installed homebrew安装自制软件

Installed rvm安装的 rvm

Ran rvm requirements run force Ran rvm requirements run force

Ran rvm install rails rvm install rails

rails new sample_app

cd sample_app

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

bundle install and it worked ! bundle install ,它工作

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

To resolve this, install openssl (preferably using brew) .要解决此问题,请安装 openssl(最好使用 brew)

Update Xcode to the latest version and enable command line installations using it.将 Xcode 更新到最新版本并使用它启用命令行安装

Reinstall rvm using rvm reinstall all使用rvm reinstall all重新安装 rvm

Note that rvm reinstall all --force will delete all your previous installations of binaries/pkgs done using rvm.请注意, rvm reinstall all --force将删除您以前使用 rvm 完成的所有二进制文件/pkg 安装。

Assuming ruby is already installed, do the following:假设 ruby​​ 已经安装,请执行以下操作:

rvm cleanup all

rvm reinstall all --force

I got the same error, and the error was fixed by opening new terminal session.我得到了同样的错误,并且通过打开新的终端会话来修复错误。

I am using frum ruby version manager.我正在使用frum ruby​​ 版本管理器。

This help me : https://gist.github.com/Irio/1496746这对我有帮助: https ://gist.github.com/Irio/1496746

$ rvm pkg install openssl

$ rvm remove 1.9.3

$ rvm install 1.9.3 --with-openssl-dir=$rvm_path/usr

gem install openssl
为我工作,但没有任何声明取决于openssl,它很奇怪

Following command solved my issue note 2.3.4 is the ruby version I am using, change as per your requirements以下命令解决了我的问题注释 2.3.4 是我正在使用的 ruby​​ 版本,根据您的要求进行更改

rvm reinstall 2.3.4 --with-openssl-dir=$rvm_path/usr

Make sure that $rvm_path is properly set, with command echo $rvm_path .使用命令echo $rvm_path确保 $rvm_path 已正确设置。 If this path is empty, check if your home folder has .rvm folder.如果此路径为空,请检查您的主文件夹是否有.rvm文件夹。

In this case use在这种情况下使用

rvm reinstall 2.3.4 --with-openssl-dir=~/.rvm/usr

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

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