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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17327953/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 22:13:56  来源:igfitidea点击:

Bundler could not find compatible versions for gem “railties” for Rails 4.0.0

ruby-on-railsruby-on-rails-4gemrailtie

提问by Brian Petersen

I am trying to upgrade to Rails 4.0.0, and I changed the gem versions of sass-railsand coffee-rails. I need to resolve this gem conflict between railsand coffee-railsbefore I can upgrade to Rails 4.

我想升级到Rails的4.0.0,和我换的宝石版本sass-railscoffee-rails。我需要解决之间的宝石冲突railscoffee-rails我可以升级到Rails的4前。

When I ran bundle updatethis is the output I got:

当我运行时,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)

My Gemfile:

我的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'

回答by nathanvda

Also bundle updateonly allows you to update one gem at a time, which is hard if you are updating to Rails 4and a whole lot of gems have to be updated at the same time.

bundle update只允许您一次更新一个 gem,如果您要更新Rails 4并且必须同时更新大量 gem ,这会很困难。

I solved this by deleting the Gemfile.lockand doing bundle install.

我通过删除Gemfile.lock和做来解决这个问题bundle install

This is of course assuming you have no conflicting explicit gem version in your Gemfileto start with. So if this fails, remove version numbers from the Gemfile.

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

回答by Ivan Schneider

Just remove gem versions (coffee-rails and sass-rails) from Gemfile and run bundle update

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

回答by andreofthecape

Run gem update railsfirst, then bundle update

运行gem update rails,然后再bundle update

回答by Mike Szyndel

You have an outdated version of Devise, use Rails 4 compatible

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

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

Also change coffee-railsto

coffee-rails改为

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

and try doing

并尝试做

bundle update coffee-rails

回答by penner

You have gems that aren't supported by Rails 4. Comment out all the gems except for Rails 4 and uncomment them one at a time after running bundle install to find the culprits. You might need to undo some of your version locks.

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

回答by Rajesh Omanakuttan

  1. Delete the Gemfile.lockfile
  2. refer herefor basic gemfile changes
  3. run bundle install
  1. 删除Gemfile.lock文件
  2. 请参阅此处了解基本的 gemfile 更改
  3. bundle install

Everything will work fine. :)

一切都会好起来的。:)