尝试在下周的新版本准备中将项目更新到RoR-v4.0.0.rc2,我对如何修复依赖性问题感到有些困惑.如果我使用捆绑更新,我会收到以下错误:
Resolving dependencies... Bundler could not find compatible versions for gem "railties": In Gemfile: requirejs-rails (>= 0) ruby depends on railties (~> 3.1.1) ruby rails (= 4.0.0.rc2) ruby depends on railties (4.0.0.rc2) Bundler could not find compatible versions for gem "rails": In Gemfile: requirejs-rails (>= 0) ruby depends on rails (~> 3.1.1) ruby rails (4.0.0.rc2)
但如果我只使用bundle,我会得到以下内容:
Resolving dependencies... Bundler could not find compatible versions for gem "activesupport": In snapshot (Gemfile.lock): activesupport (3.2.2) In Gemfile: rails (= 4.0.0.rc2) ruby depends on activesupport (= 4.0.0.rc2) ruby Running `bundle update` will rebuild your snapshot from scratch,using only the gems in your Gemfile,which may resolve the conflict.
据说,针对Rails 4 Beta here更新了requirejs-rail.仍然不确定导致该问题的依赖性,以及迫使gem出现的版本.
的Gemfile:
source 'https://rubygems.org' gem 'rails','4.0.0.rc2' group :development,:test do gem 'railroady' gem 'sqlite3' # For linux support gem 'therubyracer' end group :production do gem 'pg' gem 'thin' end gem 'sass-rails','~> 4.0.0.rc1' gem 'coffee-rails','~> 4.0.0' gem 'uglifier','>= 1.0.3' gem 'colorize' gem 'jquery-ui-rails' gem 'jquery-rails' gem 'rails-backbone' gem 'bootstrap-sass','~> 2.3.0.0' gem 'requirejs-rails' gem 'ejs' gem 'devise' gem 'better_errors','>= 0.2.0',:group => :development gem 'binding_of_caller','>= 0.6.8',:group => :development gem 'd3_rails' # for a better way of looking at the rake routes by calling rake color_routes in the console gem 'color_routes' # lets us know which user is logged in,and store in a gloabel variable gon{} gem 'gon' #browser detection gem 'browser' # FOR EASY TRANISTION TO Rails 4 gem 'protected_attributes' gem 'rails-observers' gem 'actionpack-page_caching' gem 'actionpack-action_caching'
Gemfile.lock的:
GEM remote: https://rubygems.org/ specs: actionmailer (3.2.2) actionpack (= 3.2.2) mail (~> 2.4.0) actionpack (3.2.2) activemodel (= 3.2.2) activesupport (= 3.2.2) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.1) rack (~> 1.4.0) rack-cache (~> 1.1) rack-test (~> 0.6.1) sprockets (~> 2.1.2) activemodel (3.2.2) activesupport (= 3.2.2) builder (~> 3.0.0) activerecord (3.2.2) activemodel (= 3.2.2) activesupport (= 3.2.2) arel (~> 3.0.2) tzinfo (~> 0.3.29) activeresource (3.2.2) activemodel (= 3.2.2) activesupport (= 3.2.2) activesupport (3.2.2) i18n (~> 0.6) multi_json (~> 1.0) arel (3.0.2) bcrypt-ruby (3.0.1) binding_of_caller (0.7.1) debug_inspector (>= 0.0.1) bootstrap-sass (2.3.0.1) sass (~> 3.2) browser (0.1.6) builder (3.0.4) coffee-rails (3.2.2) coffee-script (>= 2.2.0) railties (~> 3.2.0) coffee-script (2.2.0) coffee-script-source execjs coffee-script-source (1.6.2) color_routes (1.0.0) colorize (0.5.8) d3_rails (3.1.6) railties (>= 3.1.0) daemons (1.1.9) debug_inspector (0.0.2) devise (2.2.4) bcrypt-ruby (~> 3.0) orm_adapter (~> 0.1) railties (~> 3.1) warden (~> 1.2.1) ejs (1.1.1) erubis (2.7.0) eventmachine (1.0.3) execjs (1.4.0) multi_json (~> 1.0) gon (4.1.0) actionpack (>= 2.3.0) json hike (1.2.2) i18n (0.6.4) journey (1.0.4) jquery-rails (2.1.4) railties (>= 3.0,< 5.0) thor (>= 0.14,< 2.0) jquery-ui-rails (4.0.3) jquery-rails railties (>= 3.1.0) json (1.8.0) libv8 (3.11.8.17) mail (2.4.4) i18n (>= 0.4.0) mime-types (~> 1.16) treetop (~> 1.4.8) mime-types (1.23) multi_json (1.7.3) orm_adapter (0.4.0) pg (0.15.1) polyglot (0.3.3) rack (1.4.5) rack-cache (1.2) rack (>= 0.4) rack-ssl (1.3.3) rack rack-test (0.6.2) rack (>= 1.0) railroady (1.1.0) rails (3.2.2) actionmailer (= 3.2.2) actionpack (= 3.2.2) activerecord (= 3.2.2) activeresource (= 3.2.2) activesupport (= 3.2.2) bundler (~> 1.0) railties (= 3.2.2) rails-backbone (0.9.10) coffee-script (~> 2.2.0) ejs (~> 1.1.1) jquery-rails (~> 2.1.3) railties (>= 3.1.0) railties (3.2.2) actionpack (= 3.2.2) activesupport (= 3.2.2) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (~> 0.14.6) rake (10.0.4) rdoc (3.12.2) json (~> 1.4) ref (1.0.5) requirejs-rails (0.9.1) railties (>= 3.1.1,< 3.3) sass (3.2.9) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) tilt (~> 1.3) sprockets (2.1.3) hike (~> 1.2) rack (~> 1.0) tilt (~> 1.1,!= 1.3.0) sqlite3 (1.3.7) therubyracer (0.11.4) libv8 (~> 3.11.8.12) ref thin (1.5.1) daemons (>= 1.0.9) eventmachine (>= 0.12.6) rack (>= 1.0.0) thor (0.14.6) tilt (1.4.1) treetop (1.4.12) polyglot polyglot (>= 0.3.1) tzinfo (0.3.37) uglifier (2.1.1) execjs (>= 0.3.0) multi_json (~> 1.0,>= 1.0.2) warden (1.2.1) rack (>= 1.0) PLATFORMS ruby DEPENDENCIES binding_of_caller (>= 0.6.8) bootstrap-sass (~> 2.3.0.0) browser coffee-rails (~> 3.2.1) color_routes colorize d3_rails devise ejs gon jquery-rails jquery-ui-rails pg railroady rails (= 3.2.2) rails-backbone requirejs-rails sass-rails (~> 3.2.3) sqlite3 therubyracer thin uglifier (>= 1.0.3)
解决方法
问题出在requirejs-rails gem上.您可能应该在Gemfile中引用github上的master分支
gem 'requirejs-rails',git: 'git://github.com/jwhitley/requirejs-rails.git'