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
4

2 回答 2

2

问题不在sass-rails声明中。它一定是其他宝石之一。

在我的 Gemfile 中仅包含以下 gem 之后,一切正常。

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'

其他宝石之一一定有一些依赖性问题。当我发现它是哪一个时,我会更新我的答案。

于 2013-06-27T22:51:37.067 回答
0

它是一个宝石依赖问题。您必须等待 sass-rails 更新或分叉 sass-rails 并更新 gemspec 以允许 rails 4.0.0

这对于刚发布新版本的 gem 来说是相当普遍的。生活在边缘的乐趣。

于 2013-06-27T15:08:20.527 回答