2015-02-05 7 views
6

पर रूबी "बंडल इंस्टॉल" त्रुटि रूबी में काफी नया है और दूरस्थ उपकरणों के माध्यम से ऐप को तैनात करने की शर्तें है। मैंने अपनी ऐप को मुफ्त openshift खाते पर तैनात करने की कोशिश की है। और मैं रन आवेदन नहीं जानता।ओपनशेफ्ट

जब मैं अनुप्रयोग चलाने मैं इस त्रुटि मिलती है:

You have already activated rack 1.5.2, but your Gemfile requires rack 1.6.0. 
Using bundle exec may solve this. (Gem::LoadError) 

तो मैं bundle exec चलाने का प्रयास, लेकिन मैं एक और त्रुटि मिली:

Gemfile syntax error: 
/var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/Gemfile:24: 
syntax error, unexpected ':', expecting $end 
gem 'sdoc', '~> 0.4.0', group: :doc 

मैं क्योंकि मैं रूबी 2.1 इस्तेमाल किया यह हो सकता है लगता है। स्थानीय और ओपन शिफ्ट पर 5 डिफ़ॉल्ट रूप से रूबी 2.0 चलाता है।

मैंने इस विषय को How can I force a bundle install on OpenShift Online when my RAILS_ENV is set to development? पर जोर दिया था, लेकिन मुझे नहीं पता कि मैं इसे सही कर रहा हूं या नहीं। मुझे यह भी नहीं पता कि यह pre_build फ़ाइल कहां रखी जाए। मैंने इसे /var/lib/openshift/xxxxxxxxxxxxxxxxxxxxxxxxxx/app-root/runtime/repo/.openshift/action_hooks/ के तहत डालने की कोशिश की। लेकिन मुझे यकीन नहीं है कि runtime सही रेपो है।

संपादित करें 1:

यह यह मेरी Gemfile:

source 'https://rubygems.org' 


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.2.0' 
# Use sqlite3 as the database for Active Record 
gem 'sqlite3' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.1.0' 
# See https://github.com/sstephenson/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.0' 
# bundle exec rake doc:rails generates the API under doc/api. 
group: :doc do 
    gem 'sdoc', '~> 0.4.0' 
end 

# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Unicorn as the app server 
# gem 'unicorn' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug' 

    # Access an IRB console on exception pages or by using <%= console %> in views 
    gem 'web-console', '~> 2.0' 
end 

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 
gem 'tzinfo-data', platforms: [:mingw, :mswin, :jruby] 

समाधान:

रूप @Rajarshi दास ने कहा कि मैं

gem 'sdoc', '~> 0.4.0', group: :doc 

बदलना पड़ा मैं nto

group: :doc do 
    gem 'sdoc', '~> 0.4.0' 
end 

मुझे बिल्कुल पता नहीं क्यों। शायद कुछ वाक्यविन्यास मुद्दे जैसे कि मैं स्थानीय पर रूबी 2.1.5 का उपयोग कर रहा था, और उत्पादन पर 2.0.0 का उपयोग करना पड़ा। और उसके बाद मुझे gem install rails चलाया गया, भले ही मैंने रेलों की त्वरित शुरुआत की। अंत में मुझे मैन्युअल रूप से Gemfile gem 'nokogiri' में जोड़ना पड़ा। अंत में मैं bundle install चला सकता था और एप्लिकेशन काम करना शुरू कर दिया था।

+0

मैं इसे अपने Git भंडार होना जरूरी लगता है कि देख सकते हैं। फॉर्म जो मैं bulid के लिए फ़ाइलें डाउनलोड करता हूं, openshift सर्वर पर भंडार नहीं। रेलवे के लिए इसे कैसे सेट करें 2.1 तैनाती? –

+0

मुझे एक ही समस्या है। 'बंडल exec' –

+0

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

उत्तर

8

आप बस निम्नलिखित तरीके

group :doc do 
    gem 'sdoc', '~> 0.4.0' 
end 
प्लेटफार्म के लिए

platforms :jruby, :mingw, :mswin do 
    gem 'tzinfo-data' 
end 

निकालें Gemfile.lock रूप You have already activated rack 1.5.2, but your Gemfile requires rack 1.6.0

फिर bundle install

+0

फिर भी smae त्रुटि 'वाक्यविन्यास त्रुटि, अप्रत्याशित': ', $ समूह की उम्मीद है:: डॉक्टर करते हैं। मैंने ऊपर अपना जेमफाइल लगाया था। क्या आप वाकई रूबी संस्करण से संबंधित नहीं हैं? –

+0

कृपया मेरे अपडेट पोस्ट को जांचें, यह 'समूह' नहीं होना चाहिए समूह: ' –

+0

मुझे इस पंक्ति 'gem' tzinfo-data ', प्लेटफॉर्म भी बदलना पड़ा: [: mingw,: mswin,: jruby]' प्लेटफ़ॉर्म में [ : mingw,: mswin,: jruby] मणि 'tzinfo-data' अंत' करें। लेकिन अब मुझे एक और त्रुटि मिलती है: '/usr/lib/ruby/gems/1.8/gems/bundler-1.3.5/lib/bundler/dsl.rbs24:in '_normalize_options': अपरिभाषित विधि 'to_sym' के लिए [: mingw,: mswin,: jruby]: ऐरे (NoMethodError) '' आपके जेमफाइल में एक त्रुटि हुई थी, और बंडलर जारी नहीं रह सकता। ' –

5

मैं $ app_root निर्देशिका के लिए ssh जाँच करके त्रुटि हल कर सकते हैं

gem install rack

यह काम किया

+0

ने मेरे लिए टीआईआई की मदद की –

0

सुनिश्चित करें कि आपके शाखा अपने विकास के वातावरण अद्यतन जवाहरात

# bundle install

यह Gemfile बदल जाएगा में तैनाती

rhc app-configure --deployment-branch [BRANCH]

तब के लिए इस्तेमाल किया जा रहा है सुनिश्चित करें। लॉक

तैनाती जब तक

$ git add -A $ git commit -am "Updating gemfile" $ git push

प्रतीक्षा

0

मैं यहाँ समाधान के सबसे करने की कोशिश की अद्यतन किया जाता है, लेकिन मैं अभी भी अटक गई। रूबी के मौजूदा संस्करण के लिए बंडल स्थापित करने में समस्या क्या थी। आप ऐप-रूट/रनटाइम/रेपो में gem install bundler करना चाहेंगे। फिर RAILS_ENV=production bundle exec rails console

आप इस answer

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