I've got some errors in my Rails app and I'm trying to start the Rails console by issuing following command:
我的Rails应用程序中有一些错误,我试图通过发出以下命令来启动Rails控制台:
rails console
No matter what I try, I'm always getting the same error:
无论我尝试什么,我总是得到同样的错误:
/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>'
I've really tried every possible solution I found on the net, as many people encounter the same error. Unfortunately, nothing seems to work. When I try the following command:
我真的尝试过在网上找到的所有可能的解决方案,因为很多人遇到了同样的错误。不幸的是,似乎没有任何效果。当我尝试以下命令时:
ruby /usr/local/rvm/src/ruby-2.1.1/ext/readline/extconf.rb
I get following output
我得到以下输出
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 ***
Indicating that something is missing, but installing readline with apt-get doesn't make a difference either. I'm guessing it could have something to do with incompatible gem versions, as the console worked briefly some time ago. Are there any known version issues with readline? Very much people seem to have encountered problems with this gem.
表明缺少某些东西,但使用apt-get安装readline也没有什么区别。我猜它可能与不兼容的gem版本有关,因为控制台前一段时间曾短暂工作过。 readline是否存在任何已知版本问题?很多人似乎都遇到过这个宝石的问题。
4 个解决方案
#1
12
Try putting rb-readline
in your Gemfile and check this out https://*.com/a/9595841/1905235
尝试将rb-readline放入Gemfile并检查出来https://*.com/a/9595841/1905235
#2
4
I finally found a solution. It was a conjunction of several issues (gem versions, conflicting readline libraries).
我终于找到了解决方案。它是几个问题的结合(gem版本,冲突的readline库)。
Firstly, I refetched the readline lib
首先,我重新阅读了readline lib
sudo apt-get install libreadline-dev
Then I uninstalled ruby
然后我卸载了ruby
rvm remove 2.1.1
I installed ruby again
我又安装了红宝石
rvm install 2.1.1
I told RVM to use the default (2.1.1) Ruby
我告诉RVM使用默认的(2.1.1)Ruby
rvm use default
I reinstalled Rails and readline
我重新安装了Rails和readline
gem install rails
gem install readline
I got an error again launching the console, but a slightly different one:
我再次启动控制台时遇到错误,但稍有不同:
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `require': /usr/local/lib/libreadline.so.6: undefined symbol: UP - /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-linux/readline.so (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>'
So following this instructions (http://vkarthickeyan.wordpress.com/2012/02/16/mysql-symbol-lookup-error-usrlocalliblibreadline-so-6-undefined-symbol-up/), I got it to work:
所以按照这个说明(http://vkarthickeyan.wordpress.com/2012/02/16/mysql-symbol-lookup-error-usrlocalliblibreadline-so-6-undefined-symbol-up/),我得到了它的工作:
cd /usr/local/lib
mkdir temp
mv libreadline* temp
ldconfig
apt-get update
Thanks to hunterboerner for the help!
感谢hunterboerner的帮助!
#3
1
I had this problem a while back, solved by typing: rvm requirements
and installing what came back. Seemed to, although this was an older version of rvm so may no longer be relevant
我有一段时间遇到这个问题,通过输入:rvm要求和安装回来解决了这个问题。似乎,虽然这是rvm的旧版本,所以可能不再相关
#4
1
This worked out ok on a Solaris machine that had no readline, might work for you:
这在没有readline的Solaris机器上运行正常,可能适合您:
$ bundle exec irb
irb(main):001:0> require File.expand_path('config/boot')
=> true
irb(main):002:0> require File.expand_path('config/environment')
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /export/home/deploy/recon/shared/bundle/ruby/1.8/gems/rails-2.3.18/lib/rails/gem_dependency.rb:21.
Warning: NLS_LANG is not set. fallback to US7ASCII.
=> true
irb(main):027:0> require 'console_app'
=> true
#1
12
Try putting rb-readline
in your Gemfile and check this out https://*.com/a/9595841/1905235
尝试将rb-readline放入Gemfile并检查出来https://*.com/a/9595841/1905235
#2
4
I finally found a solution. It was a conjunction of several issues (gem versions, conflicting readline libraries).
我终于找到了解决方案。它是几个问题的结合(gem版本,冲突的readline库)。
Firstly, I refetched the readline lib
首先,我重新阅读了readline lib
sudo apt-get install libreadline-dev
Then I uninstalled ruby
然后我卸载了ruby
rvm remove 2.1.1
I installed ruby again
我又安装了红宝石
rvm install 2.1.1
I told RVM to use the default (2.1.1) Ruby
我告诉RVM使用默认的(2.1.1)Ruby
rvm use default
I reinstalled Rails and readline
我重新安装了Rails和readline
gem install rails
gem install readline
I got an error again launching the console, but a slightly different one:
我再次启动控制台时遇到错误,但稍有不同:
/usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/irb/completion.rb:9:in `require': /usr/local/lib/libreadline.so.6: undefined symbol: UP - /usr/local/rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/x86_64-linux/readline.so (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>'
So following this instructions (http://vkarthickeyan.wordpress.com/2012/02/16/mysql-symbol-lookup-error-usrlocalliblibreadline-so-6-undefined-symbol-up/), I got it to work:
所以按照这个说明(http://vkarthickeyan.wordpress.com/2012/02/16/mysql-symbol-lookup-error-usrlocalliblibreadline-so-6-undefined-symbol-up/),我得到了它的工作:
cd /usr/local/lib
mkdir temp
mv libreadline* temp
ldconfig
apt-get update
Thanks to hunterboerner for the help!
感谢hunterboerner的帮助!
#3
1
I had this problem a while back, solved by typing: rvm requirements
and installing what came back. Seemed to, although this was an older version of rvm so may no longer be relevant
我有一段时间遇到这个问题,通过输入:rvm要求和安装回来解决了这个问题。似乎,虽然这是rvm的旧版本,所以可能不再相关
#4
1
This worked out ok on a Solaris machine that had no readline, might work for you:
这在没有readline的Solaris机器上运行正常,可能适合您:
$ bundle exec irb
irb(main):001:0> require File.expand_path('config/boot')
=> true
irb(main):002:0> require File.expand_path('config/environment')
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /export/home/deploy/recon/shared/bundle/ruby/1.8/gems/rails-2.3.18/lib/rails/gem_dependency.rb:21.
Warning: NLS_LANG is not set. fallback to US7ASCII.
=> true
irb(main):027:0> require 'console_app'
=> true