Rails 3.0.9 遇到readline (LoadError)时的解决方法

Rails 3.0.9 遇到readline (LoadError)时的解决方法

今天在使用rails时,遇到如下错误:

rails console
/usr/local/lib/ruby/1.9.1/irb/completion.rb:9:in `require’: no such file to load — readline (LoadError)
from /usr/local/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>’
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands/console.rb:3:in `require’
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands/console.rb:3:in `<top (required)>’
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands.rb:20:in `require’
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.9/lib/rails/commands.rb:20:in `<top (required)>’
from script/rails:6:in `require’
from script/rails:6:in `<main>’

出现该错误原因可能时在安装ruby时,本机没有安装readline库。

解决方法如下(ubuntu):

sudo apt-get install libreadline5-dev

cd ruby-1.9.2-p180/ext/readline

ruby extconf.rb

make

make install


你可能感兴趣的:(Rails 3.0.9 遇到readline (LoadError)时的解决方法)