Ruby 1.9.2 和 Rails 3 无法打开 rails 控制台
[gkaykck@main myApplication]$ 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.3/lib/rails/commands/console.rb:3:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands/console.rb:3:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:20:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.3/lib/rails/commands.rb:20:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
我已经在 ruby 1.9.2p136 上安装了 rails 3,我想这没问题.但是我无法启动 rails 控制台,它给了我我复制的错误.这些应用程序在 ruby 1.8.7 上运行良好,我从未见过这样的错误.
I have installed rails 3 on ruby 1.9.2p136, which is ok i guess. But i cannot start rails console and it gives me the error i copied. The apps worked great with ruby 1.8.7 and i never saw an error like this.
有什么想法吗?
显然 ubuntu 和 ruby 并不总是像它们应该的那样捕获依赖项.
Apparently ubuntu and ruby don't always catch dependencies like they should.
来自第一次谷歌搜索(是的,我点击了这个堆栈-在检查第一个结果之前在#2 处溢出.)
From the first google hit (yeah, I clicked on this stack-overflow in place #2 before checking out the first result.)
导航到 Ruby 源代码并输入:
Navigate to the Ruby source and enter:
sudo apt-get install libreadline5-dev
cd ext/readline
ruby extconf.rb
make
sudo make install
因此,如果您使用的是其他发行版,请确保以某种方式安装 readline(源代码/包),然后从源代码在 extconf 上运行 make/install.我当然尝试了 gkaykck 的建议,但在我的系统上没有 readline 的情况下得到了这个.
So, if you're on another distro, make sure you install readline somehow (source/package), then run make/install on extconf from the source. I tried what gkaykck suggested of course but got this without readline already on my system.
$ ruby extconf.rb
checking for tgetnum() in -lncurses... no
checking for tgetnum() in -ltermcap... no
checking for tgetnum() in -lcurses... no
checking for readline/readline.h... no
checking for editline/readline.h... no