0

我正在尝试将我的应用程序更新为 Rails 5.0.1。尝试运行后bundle update出现如下错误,但是没有rack gem。

我怎样才能解决这个问题?

错误:

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

        rails (= 5.0.1) x86-mingw32 was resolved to 5.0.1, which depends on
          actionpack (= 5.0.1) x86-mingw32 was resolved to 5.0.1, which depends on
            rack (~> 2.0) x86-mingw32

        sprockets (= 2.11.3) was resolved to 2.11.3, which depends on
          rack (~> 1.0)

        sprockets (= 2.11.3) was resolved to 2.11.3, which depends on
          rack (~> 1.0) x86-mingw32

宝石文件:

source 'http://rubygems.org'
ruby '2.4.0'  # '1.9.3'
#ruby-gemset=railstutorial_rails_4_0

gem 'rails', '5.0.1'#'4.2.6'
#gem 'pg', '0.15.1'
gem 'mysql2', '0.4.5'#'0.4.4'
gem 'bootstrap-sass', '2.3.2.0'#'3.3.6'
gem 'bcrypt', '3.1.11'
gem 'faker', '1.1.2'
gem 'will_paginate', '3.1.0'
gem 'bootstrap-will_paginate', '0.0.10'
gem 'geocoder', '1.3.7'
gem 'nested_form', '0.3.2'
gem 'utf8-cleaner', '0.2.4'
gem 'sprockets', '2.11.3' #2.11.3
gem 'json', '1.8.6'#'1.8.3'
gem 'ffi'
gem 'iconv', '1.0.4'

gem 'chosen-rails', '1.5.2'
gem 'compass-rails', github: 'Compass/compass-rails'

# For image uploads
gem 'carrierwave', '0.11.2'

# For uploading CSV
gem 'roo', '2.4.0'

# DataTables
gem 'jquery-datatables-rails', '3.4.0' #  git: 'git://github.com/rweng/jquery-datatables-rails.git'
gem 'jquery-ui-rails', '5.0.5'

# Editing in line:
gem 'best_in_place', '3.1.0'

# Passing data from controller to coffeescript
gem 'gon', '6.0.1'
#gem 'jquery-turbolinks' '2.1.0'

# For searching and webservice queries-NO LONGER USED
#gem 'sunspot_rails', '2.1.0'
#gem 'sunspot_solr', '2.1.0'
gem 'progress_bar', '1.0.5'

gem 'responders', '2.2.0'

# Calendar Date and Validation
gem 'bootstrap-datepicker-rails'

# For Google Maps overlays
gem 'gmaps4rails', '~> 2.1.2'
gem 'underscore-rails', '~> 1.8.3'

group :development, :test do
  gem 'rspec-rails', '3.4.2'
  gem 'guard-rspec', '4.7.2'
  gem 'spork-rails', '4.0.0'
  gem 'childprocess', '0.5.9'
  gem 'guard-spork', '2.1.0'
end

group :test do
  gem 'selenium-webdriver', '2.53.3'
  gem 'capybara', '2.7.1'
  gem 'factory_girl_rails', '4.7.0'
end

gem 'sass-rails', '4.0.1'
gem 'uglifier', '3.0.0'
gem 'coffee-rails', '4.1.1'
gem 'jquery-rails', '4.1.1'
gem 'turbolinks', '2.5.3'
gem 'jbuilder', '2.5.0'

group :doc do
  gem 'sdoc', '0.4.1', require: false
end

gem 'rails_12factor', '0.0.3'
4

1 回答 1

3

这一切都在错误消息中:

您在Gemfile其中指定了对 gem 有冲突依赖的rackgem。Rails 5(通过 actionpack)需要机架 2,而您的固定版本sprockets需要机架 1。

因此,您有两个选择:

  1. 您可以将您的 rails 要求降级到 Rails 4,这取决于机架 1。为此,将Gemfile您指定的位置中的行替换为rails

    gem 'rails', '< 5'
    
  2. 或者(这可能是您想要的选项),您可以升级您正在使用的链轮版本。为此,您可以简单地将显式固定版本删除到sprockets您的Gemfile. 由于 Rails 已经依赖于合适的 sprocket 版本,因此您无需自己指定它为版本。通常,要在 Rails 5 中使用 sprockets,您至少需要 sprockets 3.3.5。

于 2017-02-25T23:04:01.163 回答