Bidhan Patnaik
Bidhan Patnaik

Reputation: 51

In production mode I am getting - No such file to load -- ruby-debug (LoadError)

I am using Rails 3.2.1 and the 'ruby-debug19' line has been commented out in the Gemfile. When I start the server in development mode, the server starts up without any problem. However, when I start my server in production mode (rails server -e production, I endup getting the following error (see stack trace below):

... `rescue in depend_on': No such file to load -- ruby-debug (LoadError)

I have spent quite bit of time trying to figure out who is requiring reby-debug without any luck. Not sure what to include except my Gemfile and the stack. I would really appreciate any help.

One more piece of info: line 5 in my environment.rb file is just calling "Application.initialize!"

Gemfile:

gem 'rails', '3.2.1'
gem 'mysql'
gem 'gravatar_image_tag', '0.1.0'
gem "devise", ">= 1.4.9"
gem "paperclip", "~> 2.0"
gem 'jquery-rails'
gem 'aws-sdk'
gem 'aws-s3', :require => 'aws/s3'
gem 'formtastic'
gem 'cancan'    
gem 'kaminari'
gem 'date_validator'
gem 'simple_form'
gem 'heroku'

gem 'pg', :group => :production

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails', "  ~> 3.2.3"
  gem 'coffee-rails', "~> 3.2.1"
  gem 'uglifier', '>= 1.0.3'
end

gem 'annotate','2.4.1.beta1', :group => :development
gem 'nifty-generators',       :group => :development

gem 'rspec-rails', '2.6.1.beta1', :group => [:development, :test]
gem 'faker', '0.3.1',             :group => [:development, :test]
gem 'rspec', '2.6',               :group => [:test, :development]
gem 'populator',                  :group => [:development, :test]

#gem 'ruby-debug19', :require => 'ruby-debug', :group => [:development, :test]

gem "factory_girl_rails", ">= 1.1.0", :group => :test
gem "cucumber-rails", ">= 1.0.2",     :group => :test
gem "pickle", ">=0.4.10",             :group => :test
gem "capybara", ">= 1.0.1",           :group => :test
gem "database_cleaner", ">= 0.6.7",   :group => :test
gem "launchy", ">= 2.0.5",            :group => :test
gem "email_spec",                     :group => :test
gem 'guard-rspec',                    :group => :test
gem "mocha",                          :group => :test

And here is the stack trace:

➜  taskfree git:(master) ✗ bundle exec rails server -e production
=> Booting WEBrick
=> Rails 3.2.1 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport- 3.2.1/lib/active_support/dependencies.rb:317:in `rescue in depend_on': No such file to load -- ruby-debug (LoadError)
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport3.2.1/lib/active_support/dependencies.rb:312:in `depend_on'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:225:in `require_dependency'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:438:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:438:in `block in eager_load!'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:436:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/engine.rb:436:in `eager_load!'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `instance_exec'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:30:in `run'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:55:in `block in run_initializers'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `each'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/initializable.rb:54:in `run_initializers'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/application.rb:136:in `initialize!'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/bidhan/code/taskfree/config/environment.rb:5:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `block in require'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:236:in `load_dependency'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.2.1/lib/active_support/dependencies.rb:251:in `require'
from /Users/bidhan/code/taskfree/config.ru:4:in `block in <main>'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
from /Users/bidhan/code/taskfree/config.ru:1:in `new'
from /Users/bidhan/code/taskfree/config.ru:1:in `<main>'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands/server.rb:46:in `app'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands/server.rb:70:in `start'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands.rb:55:in `block in <top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands.rb:50:in `tap'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands.rb:50:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

And here is the output when I just start my server in development mode:

➜  taskfree git:(master) ✗ bundle exec rails server              
=> Booting WEBrick
=> Rails 3.2.1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-02-17 15:09:24] INFO  WEBrick 1.3.1
[2012-02-17 15:09:24] INFO  ruby 1.9.2 (2011-07-09) [x86_64-darwin10.5.0]
[2012-02-17 15:09:24] INFO  WEBrick::HTTPServer#start: pid=33798 port=3000

Upvotes: 5

Views: 6222

Answers (1)

Trevor Rowe
Trevor Rowe

Reputation: 6538

Your Gemfile.lock can help you track down which gem has ruby-debug as a dependency. Open it up and search for 'ruby-debug' and it should be nested beneath the gem that depends on it.

That said, I do notice one issue which might cause you some grief. The aws-s3 gem and the aws-sdk gems are not compatible. They both use the AWS::S3 constant, one as a module the other as a class. You get different behaviors depending on the order they are required.

Paperclip recently replace aws-s3 as a dependency with aws-sdk. You should be able to simply remove aws-s3 from your Gemfile (unless you specifically use aws-s3 outside of paperclip). If you depend on aws-s3 outside paperclip, you will want to replace those calls with equivalent calls using aws-sdk.

Upvotes: 3

Related Questions