我正在尝试升级到Rails 4.0.0,并更改了sass-rails
和coffee-rails
的gem版本。在升级到Rails4之前,我需要解决rails
和coffee-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'
此外,bundle update
一次只允许更新一个gem,如果您要更新到Rails 4
,并且必须同时更新大量gem,则这很难。
我通过删除Gemfile.lock
并执行bundle install
来解决这个问题。
当然,这是假设您的Gemfile
中没有冲突的显式gem版本。因此,如果失败,请从Gemfile中删除版本号。
只需从Gemfile中删除gem版本(coffee rails和sass rails)并运行捆绑包更新
首先运行gem update rails
,然后运行bundle update
您有一个过时的Devise版本,请使用与Rails4兼容的
gem 'devise', '~> 3.0.0.rc'
同时将coffee-rails
更改为
gem 'coffee-rails', '~> 4.0.0'
试着做
bundle update coffee-rails
您拥有Rails 4不支持的gem。注释掉除了Rails4之外的所有gem,并在运行bundle install之后一次一个地取消注释,以找出罪魁祸首。您可能需要撤消某些版本锁定。
- 删除
Gemfile.lock
文件 - 有关基本gemfile更改,请参阅此处
- 运行
bundle install
一切都会好起来的