Getting "cannot load such file -- rack/handler/--debugger (LoadError)" when trying to start Rails server in debug mode
Asked Answered
B

0

0

I'm using Rails 5 and Ruby 2.4. I want to start my server in debug mode so that I can debug in my IDE (Aptana Studio). I tried the below but get the error ...

localhost:ruby-angular-app davea$ rails server --debugger
Exiting
/Users/davea/.rvm/gems/ruby-2.4.0/gems/rack-2.0.7/lib/rack/handler.rb:74:in `require': cannot load such file -- rack/handler/--debugger (LoadError)
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/rack-2.0.7/lib/rack/handler.rb:74:in `try_require'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/rack-2.0.7/lib/rack/handler.rb:16:in `get'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/rack-2.0.7/lib/rack/server.rb:301:in `server'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:96:in `use_puma?'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:67:in `print_boot_information'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:38:in `start'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:135:in `block in perform'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `tap'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.1.7/lib/rails/commands/server/server_command.rb:130:in `perform'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.1.7/lib/rails/command/base.rb:63:in `perform'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.1.7/lib/rails/command.rb:44:in `invoke'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/railties-5.1.7/lib/rails/commands.rb:16:in `<top (required)>'
    from /Users/davea/Documents/workspace/rails5-angular-app/ruby-angular-app/bin/rails:9:in `require'
    from /Users/davea/Documents/workspace/rails5-angular-app/ruby-angular-app/bin/rails:9:in `<top (required)>'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
    from /Users/davea/.rvm/gems/ruby-2.4.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
    from /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/Cellar/ruby/2.4.2_1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /Users/davea/Documents/workspace/rails5-angular-app/ruby-angular-app/bin/spring:15:in `<top (required)>'

These are the contents of my Gemfile,

localhost:ruby-angular-app davea$ cat Gemfile
source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.1.7'
# Use postgresql as the database for Active Record
gem 'pg', '>= 0.18', '< 2.0'
# Use Puma as the app server
gem 'puma', '~> 3.7'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
# gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
gem 'rack-cors'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'rails-controller-testing'
Backbencher answered 4/9, 2019 at 21:19 Comment(3)
It does the same on my end. Where have you read about this debugger mode ?Reprieve
I can't find the link now. Basically I'm trying to start Rails on a port so that I can set up breakpoints/debugging in my IDE (Aptana). Interested in any solutions to that end.Backbencher
You can start puma on any port : github.com/puma/puma/issues/1200 I guess this is useful if you are developing on a production machine.Reprieve

© 2022 - 2024 — McMap. All rights reserved.