6

我是 Ruby on Rails 的新手,并且正在使用 RVM 来管理 Ruby 版本。

我的笔记本电脑安装了 Ruby1.8.7,但我的项目使用的是 RVM、Ruby1.9.3 和 Rails 3.2.11。

我无法运行rails crails console没有它给我以下错误:

/home/phil/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
from /home/phil/.rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands/console.rb:3:in `require'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands.rb:38:in `require'
from /home/phil/.rvm/gems/ruby-1.9.3-p392/gems/railties-3.2.11/lib/rails/commands.rb:38:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
4

1 回答 1

11

编译 Ruby 时需要安装 readline 库。

如果您使用的是 CentOS/Redhat/Fedora Linux,请使用以下命令安装软件包:

sudo yum install readline-devel

或者,在 Ubuntu 上,使用:

sudo apt-get install libreadline6 libreadline6-dev

然后重新编译 Ruby。

于 2013-04-01T21:36:01.573 回答