Ruby 1.9.2 和 Rails 3 无法打开 rails 控制台 [英] Ruby 1.9.2 and Rails 3 cannot open rails console

查看:26
本文介绍了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

这篇关于Ruby 1.9.2 和 Rails 3 无法打开 rails 控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆