小编典典

Ruby 1.9.2和Rails 3无法打开Rails控制台

linux

[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上运行良好,并且我从未见过这样的错误。

有什么想法吗?


阅读 415

收藏
2020-06-02

共1个答案

小编典典

显然,ubuntu和ruby并不总是像应该的那样捕获依赖项。

在第一个Google匹配中(是的,我在检查第一个结果之前单击了#2处的堆栈溢出)。

导航到Ruby源,然后输入:

sudo apt-get install libreadline5-dev
cd ext/readline
ruby extconf.rb
make
sudo make install

因此,如果您在其他发行版上,请确保以某种方式安装readline(源代码/程序包),然后从源代码在extconf上运行make /
install。我尝试了gkaykck的建议,但是在我的系统上已经没有readline了。

$ 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
2020-06-02