no such file to load — openssl

2020-05-08 07:22发布

问题:

Am trying to load my rails app onto a new linux machine and i have done all the installations required and the bundle install is working .Now my problem is when i start the server (rails s) and then try to open the web app its tells me " no such file to load -- openssl "

LoadError in MembersController#index

no such file to load -- openssl

This error occurred while loading the following files: openssl i tried uninstalling openssl (apt-get remove openssl) but still the problem persist.Can some body please help me with it.thanks

Am using ruby 1.8.7 and rails 3.0.0

回答1:

Are you using RVM?

If so you may want to reinstall ruby with the location of your openssl installation passed as an option:

$ rvm remove 1.8.7
$ rvm install 1.8.7 --with-openssl-dir=/usr/local/openssl  # or wherever openssl is installed

On a Debian-based system, you can find where openssl is installed by running the following command:

$ dpkg -L openssl

Alternatively you can have RVM install openssl for you:

$ rvm package install openssl
$ rvm remove 1.8.7
$ rvm install 1.8.7 --with-openssl-dir=$HOME/.rvm/usr

Note that afterwards you'll need to re-install rails:

$ gem install rails


回答2:

I had this problem with OpenSUSE 12.1 after installing rvm (according to website instructions) and using it to install and use ruby 1.9.2.

Specifying --with-openssl-dir DID NOT solve it for me. But, after I installed libopenssl-devel with the OpenSUSE Software Management utility, "bundle install" complleted successfully.



回答3:

For me, this issue was fixed (on Debian Lenny) by installing libopenssl-ruby:

$ sudo apt-get install libopenssl-ruby

Debian (did) split the openssl support into a separate package, see what's the role of libopenssl-ruby? for more information.