debug rails 3.1.1 application

2019-02-19 07:45发布

问题:

I'm try to add a debugger to my rails 3.1.1 application which uses ruby 1.9.2. I have added the following to my gemfile:

gem 'ruby-debug19', :require => 'ruby-debug'

and I get the following error:

/.rvm/gems/ruby-1.9.2-p290@rails31/gems/ruby-debug19-0.11.6/cli/ruby-debug/interface.rb:55:in `block (2 levels) in initialize': uninitialized constant Debugger::LocalInterface::Readline (NameError)

by the way i have the following:

$ ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
$ rails -v
Rails 3.1.1
$ rvm -v
rvm 1.8.6 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]

回答1:

What made is work for me is:

sudo gem install ruby-debug19
gem install linecache19
gem install ruby-debug-base19
bundle update
rails server -u


回答2:

Did you install all the prerequisites listed in rvm notes before you installed Ruby? I'm not positive, but I think readline is a dependency for MRI on Linux.

You may also follow these instructions from the RVM site:

If you have an error when compiling pertaining to readline, you may need to attempt installing with the procedure defined below.

NOTE: Before you follow the procedure below please be sure to verify that you have installed any dependencies for the Ruby you are installing listed by the 'rvm notes' command. If you have not yet done that do so then run 'rvm remove X ; rvm install X' where X is the Ruby that you are concerned with.

$ rvm pkg install readline
$ rvm remove 1.9.2
$ rvm install 1.9.2 --with-readline-dir=$rvm_path/usr