Bundler无法为Rails 4.0.0找到gem“railties”的兼容版本

时间:2013-06-26 18:39:47

标签: ruby-on-rails ruby-on-rails-4 gem railtie

我正在尝试升级到Rails 4.0.0,并更改了sass-railscoffee-rails的gem版本。在升级到Rails 4之前,我需要在railscoffee-rails之间解决此gem冲突。

当我跑bundle update时,这是我得到的输出:

$ bundle update
Updating git://github.com/pilu/web-app-theme.git
Fetching source index from https://rubygems.org/
Resolving dependencies..............
Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    rails (= 4.0.0) ruby depends on
      railties (= 4.0.0) ruby

    coffee-rails (= 4.0.0) ruby depends on
      railties (4.0.0.rc2)

我的Gemfile

source 'https://rubygems.org'

gem 'rails', '4.0.0'

gem 'cancan'
gem 'client_side_validations'
gem 'devise', '~> 1.5.3'
gem 'dynamic_form'
gem 'execjs'
gem 'haml'
gem 'httparty'
gem 'jquery-rails'
gem 'mysql2'
gem 'paperclip', '~> 2.4'
gem 'prawn'
gem 'rails3-jquery-autocomplete'
gem 'rake', '0.9.2'
gem 'remotipart', '~> 1.0'
gem 'simple_datatables'
gem 'therubyracer'
gem 'validates_timeliness', '~> 3.0.2'
gem 'will_paginate', '~> 3.0'

gem 'turbolinks'
gem 'jquery-turbolinks'

gem 'noty-rails'

gem 'font-awesome-rails'

gem 'socket.io-rails'

gem 'attr_encrypted'

gem 'bullet', :group => 'development'

#temp for demo.managetherapy.com
#gem 'faker'

group :test do
  gem 'capybara'
  gem 'cucumber-rails', :require => false
  gem 'database_cleaner'
  gem 'factory_girl_rails'
#  gem 'faker'
  gem 'guard-rspec'
  gem 'selenium-webdriver', '2.7.0'
  gem 'webrat'
end

group :development, :test do
  gem 'faker'
  gem 'haml-rails'
  gem 'hpricot'
  gem 'rspec-rails'
  gem 'ruby_parser'
  #gem 'web-app-theme', '~> 0.8.0'
  gem 'web-app-theme', :git =>'git://github.com/pilu/web-app-theme.git'
end

gem 'sass-rails', '4.0.0'
gem 'compass-rails', '1.0.3'
gem 'coffee-rails', '4.0.0'
gem 'uglifier', '>= 2.1.1'
gem 'bootstrap-sass-rails'

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

# Deploy with Capistrano
gem 'capistrano'
gem 'rvm-capistrano'

gem 'passenger'

6 个答案:

答案 0 :(得分:69)

此外bundle update只允许您一次更新一个宝石,如果您要更新到Rails 4并且必须同时更新大量宝石,这很难。

我通过删除Gemfile.lock并执行bundle install来解决此问题。

这当然是假设您的Gemfile中没有冲突的显式宝石版本。因此,如果失败,请从Gemfile中删除版本号。

答案 1 :(得分:23)

从Gemfile中删除gem版本(coffee-rails和sass-rails)并运行捆绑更新

答案 2 :(得分:9)

你有一个过时的Devise版本,使用Rails 4兼容

gem 'devise', '~> 3.0.0.rc'

同时将coffee-rails更改为

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

并尝试

bundle update coffee-rails

答案 3 :(得分:8)

先运行gem update rails,然后bundle update

答案 4 :(得分:7)

你有Rails不支持的宝石4.注释掉除了Rails 4之外的所有宝石,并在运行bundle install之后一次取消注释它们以找到罪魁祸首。您可能需要撤消某些版本锁定。

答案 5 :(得分:2)

  1. 删除Gemfile.lock文件
  2. 请参阅here以获取基本的gemfile更改
  3. 运行bundle install
  4. 一切都会好起来的。 :)