2012-03-12 8 views
20

मुझे पता है कि इस सवाल को एक या दूसरे रूप में पहले पूछा गया है, लेकिन मुझे अभी भी इसके लिए एक समाधान समाधान नहीं मिल रहा है।रेल पर रूबी - ककड़ी चलाते समय त्रुटि: आप पहले ही सक्रिय हो चुके हैं 3.2.1 सक्रिय करें, लेकिन आपके जेमफाइल को सक्रिय रूप से 3.1.0 की आवश्यकता है।

मैं सास पाठ्यक्रम ऑनलाइन की पेशकश की ले रहा हूँ और कोड सीधे से https://github.com/saasbook/hw3_rottenpotatoes

क्लोन है जब मैं बंडल संस्करण स्थापित चलाने के बाद कमांड प्रॉम्प्ट

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/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:31:in `block in setup' 
/Users/chemin/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/runtime.rb:17:in `setup' 
/Users/chemin/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup' 
/Users/chemin/.rvm/gems/[email protected]/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/[email protected]/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/[email protected]/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load_code_file' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:171:in `load_file' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `each' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `load_files!' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:175:in `load_step_definitions' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:40:in `run!' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:43:in `execute!' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:20:in `execute' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/bin/cucumber:14:in `<top (required)>' 
/Users/chemin/.rvm/gems/[email protected]/bin/cucumber:19:in `load' 
/Users/chemin/.rvm/gems/[email protected]/bin/cucumber:19:in `<main>' 

से ककड़ी चलाने मैं एक और भी मिलता है uglier संदेश

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/[email protected]/gems/bundler-1.0.21/lib/bundler/dsl.rb:1:in `<top (required)>' 
/Users/chemin/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler/definition.rb:17:in `build' 
/Users/chemin/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler.rb:138:in `definition' 
/Users/chemin/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler.rb:126:in `load' 
/Users/chemin/.rvm/gems/[email protected]/gems/bundler-1.0.21/lib/bundler.rb:110:in `setup' 
/Users/chemin/.rvm/gems/[email protected]/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/[email protected]/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/[email protected]/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/rb_support/rb_language.rb:129:in `load_code_file' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:171:in `load_file' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `each' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime/support_code.rb:82:in `load_files!' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:175:in `load_step_definitions' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/runtime.rb:40:in `run!' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:43:in `execute!' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/lib/cucumber/cli/main.rb:20:in `execute' 
/Users/chemin/.rvm/gems/[email protected]/gems/cucumber-1.1.9/bin/cucumber:14:in `<top (required)>' 
/Users/chemin/.rvm/gems/[email protected]/bin/cucumber:19:in `load' 
/Users/chemin/.rvm/gems/[email protected]/bin/cucumber:19:in `<main>' 

उत्तर

39

कुछ समाधान हैं, जिनमें से सबसे आसानचलाने का प्रयास करना होगापहले, और देखें कि क्या आपकी समस्या हल होती है।

कि, काम नहीं करता है अपने rails3tutorial gemset हटाएं और पुन: पुन: बना:

rvm gemset delete rails3tutorial 
rvm [email protected] --create 

फिर bundle चलाने के लिए, और उम्मीद है कि यह आप के लिए अपने जवाहरात स्थापित हो जाएगा। bundle exec cucumber के साथ इसका पालन करें (मैं लगभग bundle exec का उपयोग करके हमेशा अपने चश्मा और कुके चलाता हूं ताकि यह गलती से स्टाइल रत्न लोड करने का प्रयास न करे)।

उम्मीद है कि यह काम करता है!

अद्यतन: की व्याख्या bundle exec थोड़ा और

bundle exec एक कमांड उस बंडलर आता है कि आपके Gemfile के संदर्भ में किसी भी अन्य आदेश चला जाएगा। इस मामले में, आप अनिवार्य रूप से इसे cucumber कमांड चलाने के लिए कह रहे हैं लेकिन केवल अपने जेमफाइल के रत्नों के साथ, और वर्तमान में उपलब्ध सभी रत्नों के साथ नहीं।

उदाहरण के लिए, यदि आपने पहले activesupport 3.2.1 इंस्टॉल किया है, और आपका Gemfile activesupport 3.1.0 के लिए पूछता है। जब ऐसा होता है तो मेरा मानना ​​है कि ककड़ी कमांड स्वयं 'एक्टिव्सपोर्ट' (शायद require 'cucumber/rails' के माध्यम से env.rb में कॉल करता है) में सक्रिय करता है जो आपके उपलब्ध रत्नों से इसे सक्रिय करने के सक्रिय संस्करण के किसी भी यादृच्छिक संस्करण को पकड़ता है (मान लें कि यह 3.2.1 है)। इसके बाद, यह आपकी सुविधाओं को चलाने के लिए अपने रेल पर्यावरण को लोड करने का निर्णय लेता है। जब यह आपके वास्तविक ऐप को लोड करना शुरू करता है, तो कोड आपके Gemfile.lock को देखता है और देखता है कि आप वास्तव में क्या चाहते हैं activesupport 3.1.0 है, लेकिन यह एक नए संस्करण के शीर्ष पर पुराना संस्करण लोड नहीं कर सकता है, इसलिए यह त्रुटि के साथ दुर्घटनाग्रस्त हो जाता है जेम्स लिन चिपकाया।

यही कारण है कि, यदि आप आरवीएम का उपयोग कर रहे हैं, तो अलग-अलग परियोजनाओं के लिए अलग-अलग रत्नों को रखना एक अच्छा विचार है, और यदि आप उस परियोजना पर अपने रत्न अपडेट कर रहे हैं तो रत्नों को हटाएं/दोबारा बनाएं ताकि आप ' चारों ओर रत्न के पुराने संस्करणों को रखने के लिए। वैकल्पिक रूप से, bundle exec 99% समस्याओं को हल करने के लिए भी जाता है। यदि आप आरवीएम का उपयोग नहीं कर रहे हैं, और कई परियोजनाएं हैं, तो आपके पास शायद कई अलग-अलग रत्नों के कई अलग-अलग संस्करण हैं, और आपको हमेशा bundle exec का उपयोग करना चाहिए जैसे कि रेक कार्य निष्पादित करना, खीरे की विशेषताएं और अन्य यूनिट परीक्षण आदि।

+1

धन्यवाद चल रहा बंडल निष्पादन ककड़ी काम किया! –

+0

क्या आप समझा सकते हैं कि "ककड़ी" और "बंडल निष्पादन ककड़ी" के बीच क्या अंतर है? – coelhudo

+0

@coelhudo मैंने अपने उत्तर के अंत में स्पष्टीकरण दिया :) – nzifnab

3

या आप यह सुनिश्चित करने के लिए bundle update कर सकते हैं कि आपके सभी मणि प्लगइन्स नवीनतम संस्करण हैं और यह आपके Gemfile.lock को अपडेट करेगा, इसलिए वे दोनों एकसाथ होंगे।

मैं bundle exec और bundle update के बीच अंतर लगता है कि क्या आप संस्करण अपने अनुप्रयोग के लिए पूछ प्रदान या आपके एप्लिकेशन gemfile अपडेट करें कि एप्लिकेशन मणि की पुरानी जानकारी संस्करण का कहना नहीं होगा नया संस्करण स्थापित जब और समस्या का कारण है क्योंकि बंडल चाहते है मणि फ़ाइल।

क्योंकि जब एक संस्करण विरोध होता है, यह आम तौर पर क्या आप सिस्टम वातावरण अपने अनुप्रयोग Gemfile या लॉक फ़ाइल के साथ संगत में स्थापित के रूप में आप उन्हें मणि जब के एक पुराने संस्करण का उपयोग करने की कोशिश कर नहीं करना चाहती सुनिश्चित करने के लिए एक अच्छा विचार है नया संस्करण उपलब्ध है, जब तक कि आप आरवीएम या ऐप स्तर पर समान रूप से अपने मणि सिस्टम को फ्रीज नहीं करना चाहते हैं, लेकिन फिर, जब आप रूबी ऐप वितरित करते हैं, तो यह अन्य मशीनों में समस्या का कारण बन सकता है।

अंत में, क्योंकि आपके ऐप को वितरित करने की आवश्यकता है, जब तक कि मणि फ़ाइल का नया संस्करण मौजूदा ऐप के साथ काम नहीं कर रहा है, मुझे लगता है कि इसे किसी ज्ञात कामकाजी संस्करण पर जोर नहीं देना चाहिए, जब तक कि आप हमेशा रखना नहीं चाहते यह सुरक्षित पक्ष पर है जो वैध तर्क है।

संबंधित मुद्दे