Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error when i try to load the rails console in 3.1

I get the following error when i try to load the rails console in 3.1. why do i get this? am i doing something wrong?

/home/brettlee/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError)
from /home/brettlee/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /home/brettlee/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/console.rb:3:in `require'
from /home/brettlee/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/brettlee/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:37:in `require'
from /home/brettlee/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:37:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
like image 337
Rahul Avatar asked Feb 24 '23 00:02

Rahul


1 Answers

EDIT: Bryan is right - just try installing libncurses & libreadline first, there's a good chance that'll work by itself. If that doesn't fly, you might need to do the whole ruby reinstall thing.

Really common error - it means you're missing some libraries necessary to run console.

This guide should show you how to fix it.

The short of it is, try installing libncurses & readline with the following command (I'm guessing from your directory structure you're using Ubuntu. If it's something else that doesn't use apt-get, change accordingy)

sudo apt-get install libncurses5-dev libreadline5-dev
ruby ~/.rvm/src/ruby-1.9.2-p290/readline/ext/extconf.rb
cd ~/.rvm/src/ruby-1.9.2-p290/readline/ext/
sudo make

If that doesn't work, you'll need to reinstall ruby 1.9.2 through rvm after installing the readline package. Don't uninstall the libncurses/readline packages installed through apt-get though - you'll still need 'em.

rvm package install readline
rvm remove 1.9.2
rvm install 1.9.2 --with-readline-dir=$rvm_path/usr
ruby ~/.rvm/src/ruby-1.9.2-p290/readline/ext/extconf.rb
cd ~/.rvm/src/ruby-1.9.2-p290/readline/ext/
sudo make

Hope this helps

like image 78
PlankTon Avatar answered Feb 25 '23 13:02

PlankTon