ruby-on-rails – Rails控制台:在`require’中:无法加载这样的文件 – readline(LoadError)

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – Rails控制台:在`require’中:无法加载这样的文件 – readline(LoadError)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我的Rails应用程序中有一些错误,我正在尝试通过以下命令启动Rails控制台:
rails console

无论我尝试什么,我总是遇到同样的错误

/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `require': cannot load such file -- readline (LoadError)
    from /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `<top (required)>'
    from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `require'
    from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands/console.rb:3:in `<top (required)>'
    from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `require'
    from /opt/mammie/web/icosole/vendor/bundle/ruby/2.1.0/gems/railties-3.1.3/lib/rails/commands.rb:37:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

我真的尝试了在网上发现的所有可能的解决方案,因为许多人遇到同样的错误.不幸的是,似乎没有任何工作.当我尝试以下命令:

ruby /usr/local/rvm/src/ruby-2.1.1/ext/readline/extconf.rb

我得到以下输出

checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
checking for readline/history.h... yes
checking for readline() in -lreadline... no
checking for readline() in -ledit... no
checking for editline/readline.h... no
*** /usr/local/rvm/src/ruby-2.1.1/ext/readline/extconf.rb Failed ***

指示某些东西丢失,但使用apt-get安装readline也没有任何区别.我猜测它可能与不兼容的宝石版本有关,因为控制台在一段时间之前简要地工作. readline有任何已知的版本问题吗?很多人似乎遇到了这个宝石的问题.

解决方法

尝试将rb-readline放在您的Gemfile中,并检查这个 https://stackoverflow.com/a/9595841/1905235
原文链接:https://www.f2er.com/ruby/265665.html

猜你在找的Ruby相关文章