更新到 Rails 5.1.4:Bundler 找不到 gem "rack" 的兼容版本

Updating to Rails 5.1.4: Bundler could not find compatible versions for gem "rack"

我的 Rails 应用程序是 4.2.7,我正在更新到 5.1.4。当我更改 Gemfile 时: gem 'rails', '5.1.4' 然后 运行 bundle update rails,我得到这个错误:

Bundler could not find compatible versions for gem "rack":
  In Gemfile:
    rails (= 5.1.4) was resolved to 5.1.4, which depends on
      actionpack (= 5.1.4) was resolved to 5.1.4, which depends on
        rack (~> 2.0)

    mailcatcher was resolved to 0.6.5, which depends on
      rack (~> 1.5)

我查看了 rack releases,但我不知道如何处理这些信息。我该如何解决这个问题?

我将粘贴整个 Gemfile,以免遗漏任何内容:

source 'https://rubygems.org'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.1.4'
# Use postgres as the database for Active Record
gem 'pg'
# Use SCSS for stylesheets
gem 'sass-rails' # , '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails'

gem 'haml-rails'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer',  platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
gem 'jquery-turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use unicorn as the app server
# gem 'unicorn'

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

# Use debugger
# gem 'debugger', group: [:development, :test]

gem 'rspec-rails', group: [:development, :test]
gem 'spinach-rails', group: [:development, :test]
gem 'database_cleaner', group: :test
gem 'simplecov', require: false, group: :test
gem 'selenium-webdriver', group: [:development, :test]
gem 'cancancan', '~> 1.10'

gem 'mailcatcher'
gem 'settingslogic'
gem 'devise'
gem 'factory_girl_rails', group: [:development, :test, :production]
gem 'capybara', '~> 2.7.1', group: [:development, :test]
gem 'faker'
gem 'yard', group: :development

gem 'pry-rails', group: :development
gem 'bootstrap-sass', '~> 3.3.1'
gem 'autoprefixer-rails'

gem 'simple_form'
gem 'jquery-datatables-rails', '~> 3.3.0'
gem 'jquery-ui-rails'
gem 'ajax-datatables-rails'
gem "font-awesome-rails"
gem "breadcrumbs_on_rails"
gem 'bootstrap-datepicker-rails', require: 'bootstrap-datepicker-rails', git: 'git://github.com/Nerian/bootstrap-datepicker-rails.git'
gem "font-ionicons-rails"

gem 'rack-mini-profiler', group: :development
gem "rails_best_practices", group: :development
gem 'rubocop', '~> 0.40.0', require: false, group: :development
gem 'nested_form', github: 'ryanb/nested_form'
gem "i18n-js", ">= 3.0.0.rc11"

gem 'public_activity', '~> 1.4.1'
gem 'rename', '~> 1.0.2'

gem 'charlock_holmes'
gem 'delayed_job_active_record'

gem 'carrierwave'

# PDF viewer
gem 'pdfjs_rails'

# Paginate
gem 'kaminari'
gem 'bootstrap-kaminari-views', '~> 0.0.5'

# Detect mobile/tablet device, browser type, etc.
gem 'browser'

gem 'prawn'
gem 'prawn-table'
gem 'rubyzip'
gem 'axlsx', '~> 2.0.1'
gem 'axlsx_rails'
gem 'bootstrap-multiselect-rails', '~> 0.9.9'
gem 'whenever', require: false
gem 'turnout'

gem 'ranked-model'

group :production do
  gem 'capistrano', '~> 3.5'
  gem 'capistrano-rails', '~> 1.1.0'
  gem 'capistrano-bundler'
  gem 'capistrano-rbenv', '~> 2.0'
  gem 'unicorn'
end

删除 Gemfile.lock 然后 bundle update 解决了这个问题。