首页 文章

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

提问于
浏览
37

我正在尝试升级到Rails 4.0.0,并且我更改了 sass-railscoffee-rails 的gem版本 . 我需要在 railscoffee-rails 之间解决这个gem冲突才能升级到Rails 4 .

当我运行 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 回答

  • 5

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

    我通过删除 Gemfile.lock 并执行 bundle install 解决了这个问题 .

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

  • 7

    只需从Gemfile中删除gem版本(coffee-rails和sass-rails)并运行 bundle update

  • 1

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

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

    同时将 coffee-rails 更改为

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

    并尝试做

    bundle update coffee-rails
    
  • 66

    首先运行 gem update rails ,然后运行 bundle update

  • 8

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

  • 22
    • 删除 Gemfile.lock 文件

    • 参考here了解基本的gemfile更改

    • run bundle install

    一切都会好起来的 . :)

相关问题