rails console(`require':无法加载此类文件)

时间:2014-12-05 06:23:25

标签: ruby-on-rails ruby rails-console

我遇到了rails控制台的问题,发送给我这个错误的

/usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require': cannot load such file -- readline (LoadError)
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `block in require'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /usr/local/lib/ruby/2.1.0/irb/completion.rb:9:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `block in require'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/console.rb:3:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `block in require'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:128:in `require_command!'
from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:59:in `console'
from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from /usr/local/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/commands.rb:17:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `block in require'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:247:in `require'
from /home/xploshioon/rails/mini_twitter/bin/rails:8:in `<top (required)>'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `block in load'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:232:in `load_dependency'
from /usr/local/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/dependencies.rb:241:in `load'
from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'

我和其他应用程序有类似的问题但是又解决了创建应用程序的问题。但现在我有一些代码,所以我不想再创建它。

谁知道这里有什么问题?

我有linux薄荷17 红宝石 2.1.4p265(2014-10-27修订版48166)[i686-linux] 轨道 4.1.8

1 个答案:

答案 0 :(得分:10)

首先将其添加到您的Gemfile:

gem 'rb-readline'

其次是:

bundle install

如果这不能解决问题,请按照:

安装readline:

sudo apt-get install libreadline-dev

删除并重新安装ruby

rvm remove 2.1.4    
rvm install 2.1.4

最后

bundle install