Ruby on Rails - 运行cucumber时出错:您已经激活activesupport 3.2.1,但是您的Gemfile需要activesupport 3.1.0。 [英] Ruby on Rails - error when running cucumber: You have already activated activesupport 3.2.1, but your Gemfile requires activesupport 3.1.0.

查看:278
本文介绍了Ruby on Rails - 运行cucumber时出错:您已经激活activesupport 3.2.1,但是您的Gemfile需要activesupport 3.1.0。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道这个问题在一种形式或另一种形式被问过,但我仍然不能得到一个有效的解决方案。



我参加在线提供的saas课程,代码直接从
克隆 https://github.com/saasbook/hw3_rottenpotatoes



当我从命令提示符运行cucumber

 使用默认配置文件... 
您已经激活activesupport 3.2.1,但是您的Gemfile需要activesupport 3.1.0。使用bundle exec可以解决这个问题。 (Gem :: LoadError)
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:31:in`块在设置'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:17:in'setup'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler.rb:110:in'setup'
/用户/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/setup.rb:7:in`< top(必填)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in`require'
/ Users / chemin / .rvm / rubies / ruby​​-1.9.2-p290 / lib / ruby​​ / site_ruby / 1.9.1 / ruby​​gems / custom_require.rb:59:inrescue in require
/Users/chemin/.rvm/rubies /ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in`require'
/ Users / chemin / rails_projects / saas / hw3_rottenpotatoes / config / boot。 rb:6:在`< top(必填)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require .rb:55:in`require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/application.rb1:in'< top(必填)>'
/Users/chemin/.rvm/rubies /ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in`require'
/Users/chemin/.rvm/rubies/ruby-1.9.2 -p290 / lib / ruby​​ / site_ruby / 1.9.1 / ruby​​gems / custom_require.rb:55:in`require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/environment.rb:2:in` < top(必填)"'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in`require'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-rails-1.3.0/lib/cucumber/rails.rb:7:in`< top(必填)> ;'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in`require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in`rescue in require'
/ Users / chemin /.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in`require'
/ Users / chemin / rails_projects / saas / hw3_rottenpotatoes /features/support/env.rb:7:in`< top(必需)>'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber- 1.1.9 / lib / cucumber / rb_support / rb_language.rb:129:在`load'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1。 9 / lib / cucumber / rb_support / rb_language.rb:129:在`load_code_file'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/ lib / cucumber / runtime / support_code.rb:171:in`load_file'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/ cucumber / runtime / support_code.rb:83:in'block in load_files!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib /cucumber/runtime/support_code.rb:82:in`each'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber /runtime/support_code.rb:82:in`load_files!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/ runtime.rb:175:in`load_step_definitions'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime.rb: 40:在`run!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:43 :在`execute!'中
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:20: in`execute'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/bin/cucumber:14:in`< top(必需) >'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/cucumber:19:in`load'
/Users/chemin/.rvm/gems /ruby-1.9.2-p290@rails3tutorial/bin/cucumber:19:in`< main>'

运行bundle安装版本后,我得到一个更丑的消息

 找不到rack- 1.1.0,actionmodel-3.1.0,activemodel-3.1.0,activerecord-3.1.0,activeresource-3.1.0,activesupport-3.1.0,addressable-2.2.7,archive-tar- minitar-0.5.2,arel-2.2.1,bcrypt-ruby-3.0.1,builder-3.0.0,capybara-1.1.2,childprocess-0.3.1,coffee-rails-3.1.1,coffee- 2.2.0,coffee-script-source-1.2.0,columnize-0.3.6,cucumber-1.1.8,cucumber-rails-1.3.0,cucumber-rails-training-wheels-1.0.0,database_cleaner-0.7。 1,diff-lcs-1.1.3,erubis-2.7.0,execjs-1.3.0,ffi-1.0.11,gherkin-2.8.0,ham1-3.1.4,hike-1.2.1,i18n- 0,jquery-rails-1.0.19,json-1.6.5,json_pure-1.6.5,launchy-2.0.5,libv8-3.3.10.4-x86_64-darwin-10,linecache19-0.5.12,mail-2.3。 0,mime-types-1.17.2,multi_json-1.1.0,nokogiri-1.5.0,polyglot-0.3.3,rack-1.3.6,rack-cache-1.0.3,rack-mount-0.8.3, rack-ssl-1.3.2,rack-test-0.6.1,rails-3.1.0,railties-3.1.0,rake-0.9.2.2,rdoc-3.12,ruby-debug-base19-0.11.25,ruby- debug19-0.11.6,ruby_core_source-0.1.5,rubyzip-0.9.6.1,sass-3.1.15,sass-rails-3.1.5,selenium-webdriver-2.13.0,sprockets-2.0.3,sqlite3-1.3。 5,术语 - 色杆菌1.0.7,therubyracer-0.9.10,thor-0.14.6,倾斜-1.3.3,树梢-1.4.10,tzinfo-0.3.31,微粒-1.2.3,xpath-0.1。 4](Gem :: LoadError)
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in` to_specs'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:451:in'block in find_in_unresolved'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:451:in`map'
/用户/ chemin /.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:451:in`find_in_unresolved'
/Users/chemin/.rvm/rubies/ ruby-1.9.2-p290 / lib / ruby​​ / site_ruby / 1.9.1 / ruby​​gems / custom_require.rb:43:在`require'
/Users/chemin/.rvm/gems/ruby-1.9.2- p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/dsl.rb:1:在`< top(必填)>'
/Users/chemin/.rvm/gems/ruby-1.9 .2-p290 @ rails3tutorial / gems / bundler-1.0.21 / lib / bundler / definition.rb:17:inbuild
/Users/chemin/.rvm/gems/ruby-1.9.2-p290 @ rails3tutorial / gems / bundler-1.0.21 / lib / bundler.rb:138:in'definition'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler -1.0.21 / lib / bundler.rb:126:在`load'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib /bundler.rb:110:in'setup'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/setup.rb :7:in`< top(required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require。 rb:59:in`require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in` rescue in require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in`require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/boot.rb:6:in`< top(必需)>'
/Users/chemin/.rvm/rubies/ruby-1.9。 2-p290 / lib / ruby​​ / site_ruby / 1.9.1 / ruby​​gems / custom_require.rb:55:in`require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ ruby / site_ruby / 1.9.1 / ruby​​gems / custom_require.rb:55:in`require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/application.rb:1:in`< top )>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in`require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in`require'
/ Users / chemin /rails_projects/saas/hw3_rottenpotatoes/config/environment.rb:2:in`⊤ top(必填)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ ruby / site_ruby / 1.9.1 / ruby​​gems / custom_require.rb:55:in`require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9。 1 / ruby​​gems / custom_require.rb:55:in`require'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-rails-1.3.0/lib/ cucumber / rails.rb:7:in`< top(required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1 /rubygems/custom_require.rb:59:in`require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb :59:inrescue in require
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/features/support/env.rb:7:in`⊤ top(required)>'
/Users/chemin/.rvm /gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in`load'
/Users/chemin/.rvm/gems /ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in`load_code_file'
/Users/chemin/.rvm/gems/ruby -1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:171:在`load_file'中
/Users/chemin/.rvm/gems/ruby-1.9 .2-p290 @ rails3tutorial / gems / cucumber-1.1.9 / lib / cucumber / runtime / support_code.rb:83:in'block in load_files!'
/Users/chemin/.rvm/gems/ruby- 1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:在`each'
/Users/chemin/.rvm/gems/ruby-1.9。 2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in`load_files!'
/Users/chemin/.rvm/gems/ruby-1.9.2 -p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:175:在`load_step_definitions'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial /gems/cucumber-1.1.9/lib/cucumber/runtime.rb:40:in`run!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/ cucumber-1.1.9 / lib / cucumber / cli / main.rb:43:in`execute!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber -1.1.9 / lib / cucumber / cli / main.rb:20:在`execute'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1 .9 / bin / cucumber:14:in`< top(必需)>'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/cucumber:19:在`load'中
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/cucumber:19:in`< main>'


解决方案

有几个解决方案,最简单的方法是尝试运行



如果这不起作用,请删除您的rails3tutorial gemset并重新创建

  rvm gemset delete rails3tutorial 
rvm 1.9.2-p290@rails3tutorial --create

然后运行 bundle ,希望它会安装您的宝石您。然后用 bundle exec cucumber (我几乎总是使用 bundle exec 运行我的specs和cukes,



更新:解释 bundle exec 多一点



bundle exec 是bundler自带的命令它将在您的Gemfile的上下文中运行任何其他命令。在这种情况下,你基本上是告诉它运行 cucumber 命令,但只有与Gemfile中的gem,而不是所有的gem



例如,如果您以前安装了 activesupport 3.2.1 ,并且您的Gemfile要求 activesupport 3.1.0 。当这种情况发生我相信黄瓜命令本身拉动activesupport(可能通过 require'cucumber / rails'调用env.rb),它抓住任何随机版本的activesupport它可以(让我们说它抓住3.2.1)从你可用的宝石。之后,它决定加载您的轨道环境以开始运行您的功能。当它开始加载你的实际应用程序,代码看看你的Gemfile.lock看到你实际想要的是 activesupport 3.1.0 ,但它不能加载一个旧的版本的新版本,所以它崩溃与错误詹姆斯林粘贴。



这是为什么,如果你使用rvm,这是一个好主意,保持单独的gemsets为您的单独的项目,并删除/重新创建gemsets如果你更新你的宝石在该项目,所以你不保留旧版本的gems。或者, bundle exec 也可以解决99%的问题。如果你不使用rvm,并且有多个项目,那么你可能有很多不同版本的许多不同的gem,你应该总是使用 bundle exec 来执行execute rake任务,运行cucumer功能和其他单元测试等。


I know this question has been asked in one form or the another before, but I still can't get a working solution for this.

I'm taking the saas course offered online and the code is directly cloned from https://github.com/saasbook/hw3_rottenpotatoes

When I run cucumber from the command prompt

Using the default profile...
You have already activated activesupport 3.2.1, but your Gemfile requires activesupport 3.1.0. Using bundle exec may solve this. (Gem::LoadError)
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:31:in `block in setup'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/runtime.rb:17:in `setup'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/setup.rb:7:in `<top (required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/boot.rb:6:in `<top (required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/application.rb:1:in `<top (required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/environment.rb:2:in `<top (required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-rails-1.3.0/lib/cucumber/rails.rb:7:in `<top (required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/features/support/env.rb:7:in `<top (required)>'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load_code_file'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:171:in `load_file'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `each'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:175:in `load_step_definitions'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:40:in `run!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:43:in `execute!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:20:in `execute'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/bin/cucumber:14:in `<top (required)>'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/cucumber:19:in `load'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/cucumber:19:in `<main>'

after running bundle install version I get an even uglier message

Could not find rack-cache (~> 1.1) amongst [actionmailer-3.1.0, actionpack-3.1.0, activemodel-3.1.0, activerecord-3.1.0, activeresource-3.1.0, activesupport-3.1.0, addressable-2.2.7, archive-tar-minitar-0.5.2, arel-2.2.1, bcrypt-ruby-3.0.1, builder-3.0.0, capybara-1.1.2, childprocess-0.3.1, coffee-rails-3.1.1, coffee-script-2.2.0, coffee-script-source-1.2.0, columnize-0.3.6, cucumber-1.1.8, cucumber-rails-1.3.0, cucumber-rails-training-wheels-1.0.0, database_cleaner-0.7.1, diff-lcs-1.1.3, erubis-2.7.0, execjs-1.3.0, ffi-1.0.11, gherkin-2.8.0, haml-3.1.4, hike-1.2.1, i18n-0.6.0, jquery-rails-1.0.19, json-1.6.5, json_pure-1.6.5, launchy-2.0.5, libv8-3.3.10.4-x86_64-darwin-10, linecache19-0.5.12, mail-2.3.0, mime-types-1.17.2, multi_json-1.1.0, nokogiri-1.5.0, polyglot-0.3.3, rack-1.3.6, rack-cache-1.0.3, rack-mount-0.8.3, rack-ssl-1.3.2, rack-test-0.6.1, rails-3.1.0, railties-3.1.0, rake-0.9.2.2, rdoc-3.12, ruby-debug-base19-0.11.25, ruby-debug19-0.11.6, ruby_core_source-0.1.5, rubyzip-0.9.6.1, sass-3.1.15, sass-rails-3.1.5, selenium-webdriver-2.13.0, sprockets-2.0.3, sqlite3-1.3.5, term-ansicolor-1.0.7, therubyracer-0.9.10, thor-0.14.6, tilt-1.3.3, treetop-1.4.10, tzinfo-0.3.31, uglifier-1.2.3, xpath-0.1.4] (Gem::LoadError)
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:451:in `block in find_in_unresolved'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:451:in `map'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:451:in `find_in_unresolved'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:43:in `require'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/dsl.rb:1:in `<top (required)>'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/definition.rb:17:in `build'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler.rb:138:in `definition'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler.rb:126:in `load'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.21/lib/bundler/setup.rb:7:in `<top (required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require' 
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/boot.rb:6:in `<top (required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/application.rb:1:in `<top (required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/config/environment.rb:2:in `<top (required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-rails-1.3.0/lib/cucumber/rails.rb:7:in `<top (required)>'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in `rescue in require'
/Users/chemin/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
/Users/chemin/rails_projects/saas/hw3_rottenpotatoes/features/support/env.rb:7:in `<top (required)>'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load_code_file'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:171:in `load_file'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `each'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `load_files!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:175:in `load_step_definitions'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:40:in `run!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:43:in `execute!'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:20:in `execute'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/cucumber-1.1.9/bin/cucumber:14:in `<top (required)>'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/cucumber:19:in `load'
/Users/chemin/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/cucumber:19:in `<main>'

解决方案

There's a couple solutions, the easiest of which would be to try running bundle exec cucumber first, and see if that solves your problem.

If that doesn't work, delete your rails3tutorial gemset and re-create it again:

rvm gemset delete rails3tutorial
rvm 1.9.2-p290@rails3tutorial --create

Then run bundle, and hopefully it will install your gems for you. Follow this up with bundle exec cucumber (I almost always run my specs and cukes using bundle exec so that it doesn't try accidentally loading stale gems).

Hopefully this works!

UPDATE: Explaining bundle exec a little more

bundle exec is a command that bundler comes with that will run any other command in the context of your Gemfile. In this case, you're essentially telling it to run the cucumber command but only with the gems from your Gemfile, and not with all the gems currently available.

For instance, if you have previously installed activesupport 3.2.1, and your Gemfile asks for activesupport 3.1.0. When this happens I believe the cucumber command itself pulls in 'activesupport' (maybe via the require 'cucumber/rails' call in env.rb) which grabs any random version of activesupport it can (let's say it grabs 3.2.1) from your available gems. After this, it decides to load up your rails environment to start running your features. When it starts loading your actual app, the code looks at your Gemfile.lock and sees that what you actually want is activesupport 3.1.0, but it can't load an old version on top of a new version, so it crashes with the error James Lin pasted.

This is why, if you're using rvm, it's a good idea to keep separate gemsets for your separate projects, and delete/re-create the gemsets if you're updating your gems on that project so you don't keep old versions of gems around. Alternatively, bundle exec tends to solve 99% of the problems as well. If you aren't using rvm, and have multiple projects, then you probably have many different versions of many different gems, and you should always use bundle exec to do things like execute rake tasks, run cucumer features and other unit tests, etc.

这篇关于Ruby on Rails - 运行cucumber时出错:您已经激活activesupport 3.2.1,但是您的Gemfile需要activesupport 3.1.0。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆