[英]Rails 3 - no such file to load -- openssl
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.
我去~/.rvm/src/ruby-1.9.2-head/ext/openssl。 I type : ruby extconf.rb, but I get the following:
我输入: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。
rvm pkg install openssl
(older format - rvm package install openssl
) rvm pkg install openssl
(旧格式 - rvm package install openssl
)
rvm pkg install iconv
(older format - rvm package install iconv
) 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/
检查此说明http://rvm.io/packages/openssl/ - 请记住,快速修复只是一个块而不是整个页面。
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.1
this is for ruby 1.9.1. sudo apt-get install libopenssl-ruby1.9.1
这是 ruby 1.9.1。
sudo apt-get install libopenssl-ruby
for ruby 1.8.x sudo apt-get install libopenssl-ruby
for ruby 1.8.x
first check your rvm having the openssl package.首先检查你的 rvm 是否有 openssl 包。 Go to /usr/local/src/rvm/ruby-1.9.2-p290/
转到 /usr/local/src/rvm/ruby-1.9.2-p290/
then go to ext/openssl.然后转到 ext/openssl。
type ruby extconf.rb If 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
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
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.并且不要忘记将 ruby 版本更改为您正在使用的版本。 If you have an old rvm you may should update this at first too.
如果您有旧的 rvm,您可能也应该首先更新它。
I made我做了
rvm pkg install openssl
rvm reinstall 1.9.3
and done!并做了!
You might want to try running ruby-1.9.2-rc2 instead of head?您可能想尝试运行 ruby-1.9.2-rc2 而不是 head? not sure if it will solve this issue or not, but I did have a lot of problems trying to run under 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您将需要再次重新安装导轨
This error means that your Ruby isn't compiled with openssl.这个错误意味着你的 Ruby 不是用 openssl 编译的。 Assuming that you use RVM, these are the steps to follow to fix this issue.
假设您使用 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. 4.现在一切都应该正常了。 Don't forget to:
不要忘记:
rvm use 1.9.3 --default rvm 使用 1.9.3 --default
Try the below steps.请尝试以下步骤。
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.