no such file to load -- openssl - ruby-on-rails-3

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

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

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.

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.

Using rbenv.
I had this issue after upgrading to Ubuntu 20.04 LTS.
Upgrading to newer version of ruby-build by following rbenv documentation ( do not forget dependencies at the beginning of the tutorial )
https://github.com/rbenv/ruby-build/wiki#updating-ruby-build
and then installing new version of ruby 2.7.1 ( previosly 2.6.0 ) and setting the new version locally where I use it, solved the problem.

Related

Unable to install ruby using RVM on WSL 2 and Ubuntu

I have a windows 10 machine with WSL 2 and Ubuntu 20.x installed. I installed RVM on Ubuntu. RVM seems to be installed fine, but when I try and install a ruby rvm install 3.1.2 I get the error mkdir: cannot create directory ‘/usr/share/rvm/log/1658255479_ruby-3.1.2’: Permission denied Anything special I should be doing on WSL 2 to make this work?
I can reproduce this exact error if I try rvm install 3.1.2 without having added my user to the rvm group per the installation instructions. Is it possible that you missed this step?
sudo usermod -a -G rvm $USER
After adding the user, then exiting the shell/WSL and restarting, rvm install 3.1.2 (almost) worked as expected. It appears there's a slight bug where it asks for the sudo password on the same line as a previous Updating system.. line, so it's easy to miss, but this is recoverable.

YAML safe loading is not available

When I want to install compass with gem install compass, I occurred with this error:
YAML safe loading is not available.
Please upgrade psych to a version that supports safe loading (>= 2.0).
what The cause of this error and how can I solve the problem?
It sounds like the psych gem needs to be updated. Try running gem install psych and then gem update psych.
Suggested by looking at the psych readme file here: https://github.com/ruby/psych/blob/master/README.md
EDIT: you might also have to update your version of ruby. This depends on how you have installed ruby, but #ewerx has one suggestion in their answer.
To resolve this I first upgraded Ruby from 2.0.x to 2.4.2 (https://gorails.com/setup/osx/10.12-sierra):
rbenv install 2.4.2;
rbenv global 2.4.2
Then updated gems:
sudo gem update --system;
gem update
It may be sufficient to just update gems.
The following part of the post on https://gorails.com/setup/osx/10.12-sierra solved my issue.
We will be setting up a Ruby on Rails development environment on macOS 10.12 Sierra.
Older versions of OS X are mostly compatible so follow along as far as you can and then Google search for any problems you run into. There are plenty of people who have documented solutions for them.
Installing Homebrew
First, we need to install Homebrew. Homebrew allows us to install and compile software packages easily from source.
Homebrew comes with a very simple install script. When it asks you to install XCode CommandLine Tools, say yes.
Open Terminal and run the following command:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Installing Ruby
Choose the version of Ruby you want to install:
Now that we have Homebrew installed, we can use it to install Ruby.
We're going to use rbenv to install and manage our Ruby versions.
To do this, run the following commands in your Terminal:
brew install rbenv ruby-build
Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
Install Ruby
rbenv install 2.5.1
rbenv global 2.5.1
ruby -v

Passenger Apache Module install - installer not finding installed libraries

I am trying to host a Rails app, in a VPS server. The server already, has Apache, installed, so I am trying to install passenger first, then passenger-apache-module.
I have installed RVM as the user, and ruby 1.9.3 and set it as the default ruby. Then, I installed passenger gem, version 3.0.17, as we are migrating the rails app, and the passenger version in the old server is 3.0.17. I was able to install passenger gem with the command gem install passenger -v 3.0.17.
After installing passenger, I went ahead and tried to install passenger-apache-module using the passenger-install-apache2-module command. I am getting this output:
Checking for required software...
* GNU C++ compiler... not found
* Curl development headers with SSL support... not found
* OpenSSL development headers... not found
* Zlib development headers... not found
* Ruby development headers... found
* OpenSSL support for Ruby... found
* RubyGems... found
* Rake... found at /home/federaltitle/.rvm/wrappers/ruby-1.9.3-p448/rake
* rack... found
* Apache 2... found at /usr/local/apache/bin/httpd
* Apache 2 development headers... found at /usr/bin/apxs
* Apache Portable Runtime (APR) development headers... found at /usr/local/apache/bin/apr-1-config
* Apache Portable Runtime Utility (APU) development headers... found at /usr/local/apache/bin/apu-1-config
Some required software is not installed.
But don't worry, this installer will tell you how to install them.
Press Enter to continue, or Ctrl-C to abort.
When I hit Enter, I am getting this output:
Installation instructions for required software
* To install GNU C++ compiler:
Please run yum install gcc-c++ as root.
* To install Curl development headers with SSL support:
Please run yum install curl-devel as root.
* To install OpenSSL development headers:
Please run yum install openssl-devel as root.
* To install Zlib development headers:
Please run yum install zlib-devel as root.
If the aforementioned instructions didn't solve your problem, then please take
a look at the Users Guide:
/home/federaltitle/.rvm/gems/ruby-1.9.3-p448/gems/passenger-3.0.17/doc/Users guide Apache.html
But, when I try to install the libraries mentioned in the message (yum install gcc-c++, yum install curl-devel, yum install openssl-devel, yum install zlib-devel) as root user, it is saying all the libraries are already installed and up-to-date.
Server Details
OS - CENTOS 6.4 x86_64
I was able to install the rvm, ruby and passenger as root, and the issue was fixed. Something to do with permission, when done as user. But I had to do some workarounds for the user related activities on the ruby part like bundle install, rake assets:precompile (had to do this as root, so gave sudo permission for the local user to perform these).

can't get "rails console" to work on ubuntu 11.10

I want to use rails console and I'm using ubuntun 11.10 currently I have found the issue
error is something :
completion.rb:9:in `require': no such file to load -- readline (LoadError)
and I found a way to solve it:
http://blog.jasonmeridth.com/2010/11/25/readline-error-with-rvm-and-rails-3.html
but seems in ubuntu 11.10 the libreadline5-dev is missed and it is replaced with version 6
I installed version 6 and also I get the version 5 from
https://launchpad.net/ubuntu/oneiric/i386/libreadline-gplv2-dev/5.2-9ubuntu1
but yet if I try to run following code :
ruby extconf.rb
I'll get following lines :
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
the "no"s part is my problem , so how can I solve this problem?
Ubuntu 11.10 uses newer readline library which not in sync with the readline package offered by rvm
To solve this (assuming you use single-user installation of rvm) do:
1) ensure you have installed ubuntus readline and editline dev packages
sudo apt-get install libreadline6 libreadline6-dev
2) configure ruby's readline extension to use the systems libs, not rvm's packages
rvm pkg uninstall readline
cd ~/.rvm/src/ruby-1.9.2-p290/ext/readline
ruby extconf.rb --with-editline-dir=/usr/ --with-readline-dir=/usr/
make
make install
3) go to your project and start up the rails console
Tip: You can call
rvm requirements
to see what ubuntu packages should be installed to use rvm ruby
You have to install the readline development packages before compiling ruby. Just run
sudo apt-get install libreadline6-dev
Alternative (as suggested in the article you linked) you can use RVM to get the appropriate readline sources by running
rvm package install readline
Edit: Once you've installed the readline packages from source, you can install your rubies like this
rvm install 1.9.3 --with-readline-dir="$rvm_path/usr"
If you alredy have installd a specific ruby, just use reinstall instead on install.

I can't seem to get rails installed on my Mac (10.6.5). Following Ruby on Rails Tutorial 3

I'm trying to get Rails 3 up and running by following the steps outlined in "Ruby on Rails Tutorial" by Michael Hartl (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book).
The details start in section 1.2.2 (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec:rubygems). Here you go through the following steps:
Installing Git
Installing Ruby (version 1.9.2) using Ruby Version Manager (RVM)
Creating different gemsets for environments using Ruby 1.8.7 and 1.9.2
Installing RubyGems
and finally, installing Rails.
I run the following command [sudo] gem install rails --version 3.0.7
Everything seemed to install correctly (based on no errors). However, when I type "rails -v", rails cannot be found.
I am a Rails newbie. I'm trying to install Rails on a machine running Mac OS X 10.6.7.
Thanks.
If you are using RVM you probably don't want to use sudo when installing gems. If you have Git installed only steps needed to get Rails are:
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.zshrc
# Reload your shell now (open a new terminal for example)
rvm install 1.9.2
rvm 1.9.2 --default
gem install rails --version 3.0.7
hash -r
This skips the gemsets part (you don't need it if you are just starting learning Rails) and assumes that you use Zsh (I think it's Mac OS X default, if you use Bash then you have to alter .bashrc, not .zshrc).
If you want to remove your previous installation and start over use rvm implode.