简体   繁体   English

我尝试在3.1中加载rails控制台时出错

[英]error when i try to load the rails console in 3.1

I get the following error when i try to load the rails console in 3.1. 当我尝试在3.1中加载rails控制台时出现以下错误。 why do i get this? 为什么我会这样? am i doing something wrong? 难道我做错了什么?

/home/brettlee/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/completion.rb:9:in `require': no such file to load -- readline (LoadError)
from /home/brettlee/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>'
from /home/brettlee/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/console.rb:3:in `require'
from /home/brettlee/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands/console.rb:3:in `<top (required)>'
from /home/brettlee/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:37:in `require'
from /home/brettlee/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:37:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

EDIT: Bryan is right - just try installing libncurses & libreadline first, there's a good chance that'll work by itself. 编辑:布莱恩是对的 - 首先尝试安装libncurses和libreadline,这是一个很好的机会,它将自己工作。 If that doesn't fly, you might need to do the whole ruby reinstall thing. 如果这不会飞,你可能需要做整个ruby重新安装的事情。

Really common error - it means you're missing some libraries necessary to run console. 真正常见的错误 - 这意味着您缺少运行控制台所需的一些库。

This guide should show you how to fix it. 本指南应该向您展示如何解决它。

The short of it is, try installing libncurses & readline with the following command (I'm guessing from your directory structure you're using Ubuntu. If it's something else that doesn't use apt-get, change accordingy) 缺点是,尝试使用以下命令安装libncurses和readline(我猜测你的目录结构是否正在使用Ubuntu。如果它是其他不使用apt-get的东西,请更改)

sudo apt-get install libncurses5-dev libreadline5-dev
ruby ~/.rvm/src/ruby-1.9.2-p290/readline/ext/extconf.rb
cd ~/.rvm/src/ruby-1.9.2-p290/readline/ext/
sudo make

If that doesn't work, you'll need to reinstall ruby 1.9.2 through rvm after installing the readline package. 如果这不起作用,则需要在安装readline包后通过rvm重新安装ruby 1.9.2。 Don't uninstall the libncurses/readline packages installed through apt-get though - you'll still need 'em. 不要卸载通过apt-get安装的libncurses / readline包 - 你仍然需要它们。

rvm package install readline
rvm remove 1.9.2
rvm install 1.9.2 --with-readline-dir=$rvm_path/usr
ruby ~/.rvm/src/ruby-1.9.2-p290/readline/ext/extconf.rb
cd ~/.rvm/src/ruby-1.9.2-p290/readline/ext/
sudo make

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM