ruby-on-rails – 从Rails 3.2升级到Rails 4时出错

升级到Rails 4时遇到以下错误:

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    rails (= 4.0.0) ruby depends on
      railties (= 4.0.0) ruby

    sass-rails (~> 4.0.0) ruby depends on
      railties (4.0.0.rc2)

我的Gemfile看起来像这样:

source 'https://rubygems.org'
ruby '2.0.0'

gem 'rails', '4.0.0'

gem 'sass-rails',   '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'

# Other gems

任何帮助将不胜感激.

更新

整个Gemfile如下

source 'https://rubygems.org'
ruby '2.0.0'

gem 'rails', '4.0.0'

gem 'sass-rails',   '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'less', '~> 2.3.1'
gem 'uglifier', '>= 1.0.3'
gem 'therubyracer', '0.11.0', platforms: :ruby
gem 'less-rails-fontawesome', '~> 0.4.0'
gem 'hogan_assets', '~> 1.5.1'
gem 'datejs-rails', '~> 2.0.1'
gem 'flot-rails', '~> 0.0.3'

gem 'jquery-rails', '~> 2.1.2'
gem 'jquery-ui-rails', '~> 4.0.3'
gem 'pg', '~> 0.14.1'
gem 'pg_search', '~> 0.5.7'
gem 'devise', '~> 2.2.4'
gem 'cancan', '~> 1.6.9'
gem 'slim-rails', '~> 1.1.0'
gem 'less-rails-bootstrap', '~> 2.3.2'
gem 'rmagick', '~> 2.13.1'
gem 'mime-types', '~> 1.19'
gem 'carrierwave', '~> 0.7.1'
gem 'kaminari', '~> 0.14.1'
gem 'carmen-rails', git: 'git://github.com/jim/carmen-rails.git'
gem 'pacecar', '~> 1.5.3'
gem 'ancestry', '~> 1.3.0'
gem 'acts-as-taggable-on', '~> 2.3.3'
gem 'state_machine', '~> 1.1.2'
gem 'dynamic_form', '~> 1.1.4'
gem 'simple_form', '~> 2.1.0'
gem 'rdiscount', '~> 1.6.8'
gem 'nokogiri', '~> 1.5.6'
gem 'htmlentities', '~> 4.3.1'
gem 'bootstrap-wysihtml5-rails', '~> 0.3.1.14'
gem 'settingslogic', '~> 2.0.9'
gem 'simple-navigation', '~> 3.9.0'
gem 'range_validator', '~> 0.2.1'
gem 'valid_email', '~> 0.0.4'
gem 'ransack', '~> 0.7.2'
gem 'mongoid', '~> 3.1.3'
gem 'bson_ext', '~> 1.8.2'
gem 'rails3-jquery-autocomplete', '~> 1.0.10'
gem 'validates_timeliness', '~> 3.0'
gem 'time_diff', '~> 0.3.0'
gem 'responders', '~> 0.9.3'
gem 'tenacity', '~> 0.6.0'
gem 'puma', '~> 1.6.3'
gem 'redis', '~> 3.0.2'
gem 'country_select', '~> 1.1.3'
gem 'sidekiq', '~> 2.7.5'
gem 'action_presenter', '~> 1.1.6'
gem 'bootstrap-datetimepicker-rails', '~> 0.0.10'

group :development do
  gem 'bullet', '~> 4.3.0'
  gem 'uniform_notifier', '~> 1.1.1'
  gem 'battlestation', '~> 0.0.3'
  gem 'libv8', '3.11.8.4', platform: :ruby
  gem 'foreman', '~> 0.61.0'
  gem 'better_errors', '~> 0.3.2'
  gem 'binding_of_caller', '~> 0.7.1'
  gem 'meta_request', '~> 0.2.1'
end

group :development, :test do
  gem 'rspec-rails', '~> 2.13.0'
  gem 'fakeweb', '~> 1.3.0'
  gem 'timecop', '~> 0.5.7'
  gem 'quiet_assets', '~> 1.0.1'
  gem 'forgery', '~> 0.5.0'
  gem 'seedbank', '~> 0.2.0'
  gem 'factory_girl_rails', '~> 4.1.0'
  gem 'mongoid-rspec', '~> 1.5.6'
end

group :test do
  gem 'capybara', '~> 2.0.2'
  gem 'capybara-webkit', '~> 0.14.1'
  gem 'launchy', '~> 2.2.0'
  gem 'shoulda-matchers', '~> 2.0.0'
  gem 'database_cleaner', '~> 0.9.1'
  gem 'rspec-html-matchers', '~> 0.4.0'
end

最佳答案 问题不在sass-rails声明中.它一定是其他宝石之一.

在我的Gemfile中只包含以下宝石后,一切正常.

source 'https://rubygems.org'
ruby '2.0.0'

gem 'rails', '4.0.0'

gem 'sass-rails',   '~> 4.0.0'
gem 'coffee-rails', '~> 4.0.0'

其中一个宝石必须有一些依赖性问题.当我发现它是哪一个时,我会更新我的答案.

点赞