Ruby-on-rails Rails 3 - 没有要加载的文件 - openssl

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3464098/
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 23:01:53  来源:igfitidea点击:

Rails 3 - no such file to load -- openssl

ruby-on-railsrubyruby-on-rails-3opensslrvm

提问by Bart

when running a Rails server, I get the following error: no such file to load -- openssl

运行 Rails 服务器时,出现以下错误:没有要加载的此类文件 -- openssl

I try a solution I find online. I go to ~/.rvm/src/ruby-1.9.2-head/ext/openssl. I type : ruby extconf.rb, but I get the following:

我尝试了我在网上找到的解决方案。我去~/.rvm/src/ruby-1.9.2-head/ext/openssl。我输入:ruby extconf.rb,但我得到以下信息:

=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above.

I cannot use make nor make install.

我不能使用 make 或 make install。

回答by Ken Ratanachai S.

rvm pkg install openssl(older format - rvm package install openssl)
rvm pkg install iconv(older format - rvm package install iconv)
rvm remove 1.9.2
rvm install 1.9.2 -C --with-openssl-dir=$HOME/.rvm/usr,--with-iconv-dir=$HOME/.rvm/usr

rvm pkg install openssl(旧格式 - rvm package install openssl
rvm pkg install iconv(旧格式 - rvm package install iconv
rvm remove 1.9.2
rvm install 1.9.2 -C --with-openssl-dir=$HOME/.rvm/usr,--with-iconv-dir=$HOME/.rvm/usr

Credit to http://www.isnull.com.ar/

归功于 http://www.isnull.com.ar/

回答by Reactormonk

check this instruction http://rvm.io/packages/openssl/- keep in mind that the Quick fixis just one block not the whole page.

检查此说明http://rvm.io/packages/openssl/- 请记住,快速修复只是一个块而不是整个页面。

回答by Muhammad Sannan Khalid

You have to install library for openssl/net/http run the following code and then install openssl and iconv.. Following code will work on UBUNTU..

您必须为 openssl/net/http 安装库,运行以下代码,然后安装 openssl 和 iconv.. 以下代码将适用于 UBUNTU..

sudo apt-get install libopenssl-ruby1.9.1this is for ruby 1.9.1.

sudo apt-get install libopenssl-ruby1.9.1这是针对 ruby​​ 1.9.1 的。

sudo apt-get install libopenssl-rubyfor ruby 1.8.x

sudo apt-get install libopenssl-ruby对于 ruby​​ 1.8.x

回答by Thillai Narayanan

first check your rvm having the openssl package. Go to /usr/local/src/rvm/ruby-1.9.2-p290/

首先检查你的 rvm 是否有 openssl 包。转到 /usr/local/src/rvm/ruby-1.9.2-p290/

then go to ext/openssl.

然后转到 ext/openssl。

type ruby extconf.rbIf we found errors like this

输入ruby extconf.rb如果我们发现这样的错误

enter code here
=== OpenSSL for Ruby configurator ===
=== Checking for system dependent stuff... ===
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
checking for assert.h... yes
=== Checking for required stuff... ===
checking for openssl/ssl.h... no
=== Checking for required stuff failed. ===
Makefile wasn't created. Fix the errors above

Then install apt-get install libssl-dev.Once installed rub ruby extconf.rb.Now the openssl will get installed

然后安装 apt-get install libssl-dev.Once installed rub ruby extconf.rb。现在将安装 openssl

回答by stebooks

For ubuntu, I did the following:

对于 ubuntu,我做了以下事情:

apt-get install libssl-dev
cd ruby-1.9(source directory used to install ruby)/ext/openssl
ruby extconf.rb
make
make install

回答by tbraun89

This solved the problem for me:

这为我解决了问题:

rvm pkg install openssl
rvm reinstall 1.9.2 --with-openssl-dir=$rvm_path/usr

And don't forget to change the ruby version to your version you are using. If you have an old rvm you may should update this at first too.

并且不要忘记将 ruby​​ 版本更改为您正在使用的版本。如果您有旧的 rvm,您可能也应该首先更新它。

回答by sites

I made

我做了

rvm pkg install openssl
rvm reinstall 1.9.3

and done!

并做了!

回答by Praveen George

This error means that your Ruby isn't compiled with openssl. Assuming that you use RVM, these are the steps to follow to fix this issue.

这个错误意味着你的 Ruby 不是用 openssl 编译的。假设您使用 RVM,以下是解决此问题的步骤。

1.Install the openssl package

1.安装openssl包

rvm pkg install openssl

2.Remove the Ruby installation you're using

2.删除你正在使用的Ruby安装

rvm remove 1.9.3

3.And finally recompile Ruby with openssl

3.最后用openssl重新编译Ruby

rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr

4.Everything should be working now. Don't forget to:

4.现在一切正常。不要忘记:

rvm use 1.9.3 --default

rvm 使用 1.9.3 --default

回答by Tarkik

Try the below steps.

请尝试以下步骤。

  1. rvm get stable
  2. brew install libyaml
  3. rvm pkg install openssl
  4. rvm install ruby-2.0.0 --with-openssl-dir=$HOME/.rvm/usr
  5. rvm use ruby-2.0.0
  1. rvm 稳定
  2. brew 安装 libyaml
  3. rvm pkg 安装 openssl
  4. rvm install ruby​​-2.0.0 --with-openssl-dir=$HOME/.rvm/usr
  5. rvm 使用 ruby​​-2.0.0

if you already have ruby version use

如果您已经有 ruby​​ 版本,请使用

rvm reinstall ruby-2.0.0 --with-openssl-dir=$HOME/.rvm/usr

rvm 重新安装 ruby​​-2.0.0 --with-openssl-dir=$HOME/.rvm/usr

回答by house9

You might want to try running ruby-1.9.2-rc2 instead of head? not sure if it will solve this issue or not, but I did have a lot of problems trying to run under head

您可能想尝试运行 ruby​​-1.9.2-rc2 而不是 head?不确定它是否会解决这个问题,但我确实在尝试运行时遇到了很多问题

pretty sure the the command would look like - rvm install 1.9.2-rc2

很确定命令看起来像 - rvm install 1.9.2-rc2

you will need to re-install rails again

您将需要再次重新安装导轨