5
votes

I'm trying to create a new Rails project and when I run rails new appname it tells me

Could not find debugger-1.6.8 in any of the sources
Run `bundle install` to install missing gems.

Then when I run bundle install I get this error

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /Users/username/.rvm/rubies/ruby-2.1.4/bin/ruby -r ./siteconf20141213-76431-12dyum4.rb extconf.rb 
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
  --with-opt-dir
  --without-opt-dir
  --with-opt-include
  --without-opt-include=${opt-dir}/include
  --with-opt-lib
  --without-opt-lib=${opt-dir}/lib
  --with-make-prog
  --without-make-prog
  --srcdir=.
  --curdir
  --ruby=/Users/username/.rvm/rubies/ruby-2.1.4/bin/ruby
/Users/username/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1401:in `initialize': No such file or directory @ rb_sysopen - ./214/ruby_debug.h (Errno::ENOENT)
  from /Users/username/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1401:in `open'
  from /Users/username/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1401:in `copy_file'
  from /Users/username/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:483:in `copy_file'
  from /Users/username/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:400:in `block in cp'
  from /Users/username/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1579:in `block in fu_each_src_dest'
  from /Users/username/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1593:in `fu_each_src_dest0'
  from /Users/username/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:1577:in `fu_each_src_dest'
  from /Users/username/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/fileutils.rb:399:in `cp'
  from extconf.rb:83:in `block in '
  from extconf.rb:82:in `each'
  from extconf.rb:82:in `'

extconf failed, exit code 1

Gem files will remain installed in /Users/username/.rvm/gems/ruby-2.1.4/gems/debugger-1.6.8 for inspection.
Results logged to /Users/username/.rvm/gems/ruby-2.1.4/extensions/x86_64-darwin-13/2.1.0-static/debugger-1.6.8/gem_make.out 

I know that debugger doesn't work with Ruby 2.1.4, so how do i get bundler to stop trying to install it? Do i have to use a rails application template?

2
What is your Rails version? 4.1.8 doesn't include debugger by default, it's commented out.D-side
looks like you are missing some development headers. Does the content of /Users/username/.rvm/gems/ruby-2.1.4/extensions/x86_64-darwin-13/2.1.0-static/debugger-1.6.8/gem_make.out give any clues?ptierno
I believe I'm using 4.1.8 , so if its commented out, shouldn't I not be getting that error?drabnew
gem_make out gives me the same error that i printed above, character limits wont let me print the whole thing againdrabnew
@PeteyT I run gem install debugger and it gives me the same output. Since my environment is fine (I'm sure of it), debugger is just not supported by this Ruby (MRI 2.1.4p265) and byebug should be used instead.D-side

2 Answers

2
votes

So for this exact case -- comment out or remove it and any gems that depend on it (look at Gemfile.lock) from your Gemfile at the root of your project, then run bundle install.

Rails 4.1.8 actually generates an app's Gemfile with debugger commented out, so it should already work fine.

If you actually need a debugger, you can use byebug, a replacement for debugger for Ruby 2.0+. In the upcoming Rails 4.2.0 release it's already baked into the generator.

When creating a new app, you can also add an option -B or --skip-bundle to not run bundle install after creating an app skeleton. Then you can fix your Gemfile and run bundle install yourself in the project's folder. That only saves you a bit of time though.

0
votes

The reason for this failure is 'byebug' gem which is present in your Gemfile .you can see it in your 'develpement & test' group of Gemfile which looks something like

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'

'byebug' has the same functionality as 'debugger' - Anyone interested in documentation can visit Github .