Getting “cannot load such file — rack/handler/--debugger (LoadError)” when trying to start Rails server in debug mode

早过忘川 提交于 2021-01-29 15:09:50

问题


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'

来源:https://stackoverflow.com/questions/57795758/getting-cannot-load-such-file-rack-handler-debugger-loaderror-when-tryi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!