切换到Capistrano后,乘客在Rails应用上出现Bundler :: GemfileError [英] Bundler::GemfileError on Rails app on Passenger after switching to Capistrano

查看:66
本文介绍了切换到Capistrano后,乘客在Rails应用上出现Bundler :: GemfileError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Rails应用程序,该应用程序在生产中使用Apache的Phusion Passenger上运行。当我以前手动进行部署(通过SSH进入服务器并获取最新更新等)时,一切正常,但是最近我改用Capistrano来简化团队成员的工作。现在,当我尝试访问该网站时,Passenger抛出以下错误: Exception PhusionPassenger :: UnknownError in PhusionPassenger :: Rack :: ApplicationSpawner(您的Gemfile中存在错误,Bundler无法继续。( Bundler :: GemfileError))

I have a rails app that runs on Phusion Passenger with Apache in production. Everything worked when I used to manually deploy (by SSH-ing in to the server and fetching the latest updates, etc.), but I recently switched to Capistrano to make life easier on my team members. Now, when I try to access the site, Passenger throws the following error: Exception PhusionPassenger::UnknownError in PhusionPassenger::Rack::ApplicationSpawner (There was an error in your Gemfile, and Bundler cannot continue. (Bundler::GemfileError))

如果我运行rails控制台 bundle exec rails console production ,然后运行 app.get('/'),它会返回状态码200。因此,仅当请求通过乘客时才会抛出此GemfileError。

If I run the rails console bundle exec rails console production, and run app.get('/'), it gives back status code 200. So this GemfileError only gets thrown when the request passes through Passenger.

我一直为我拥有的每个Rails应用程序使用rvm和gemsets,但是Capistrano现在将捆绑包安装在 / var / www / mywebsite / shared / bundle

I have always used rvm with gemsets for each rails app I have, but Capistrano now installs the bundle in /var/www/mywebsite/shared/bundle.

在我看来,像rvm和capistrano在处理宝石的方式上存在冲突,但这并不能解释为什么它会产生GemfileError

Seems to me like rvm and capistrano are conflicting in the way they handle gems, but that doesn't explain why it would give a GemfileError only in this environment.

There was an error in your Gemfile, and Bundler cannot continue. (Bundler::GemfileError)



异常类:



Exception class:

PhusionPassenger::UnknownError



应用程序根目录:



Application root:

/var/www/3eadmin/current



回溯



Backtrace

#   File    Line    Location
0   /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/dsl.rb   12  in `rescue in evaluate'
1   /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/dsl.rb   6   in `evaluate'
2   /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/definition.rb    18  in `build'
3   /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler.rb   144 in `definition'
4   /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler.rb   112 in `setup'
5   /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/bundler-1.2.3/lib/bundler/setup.rb 17  in `'
6   /home/hatd/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb  60  in `require'
7   /home/hatd/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb  60  in `rescue in require'
8   /home/hatd/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb  35  in `require'
9   /var/www/3eadmin/releases/20121207090404/config/setup_load_paths.rb 17  in `'
10  /home/hatd/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb  36  in `require'
11  /home/hatd/.rvm/rubies/ruby-1.9.3-p327/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb  36  in `require'
12  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/utils.rb    301 in `prepare_app_process'
13  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/rack/application_spawner.rb 156 in `block in initialize_server'
14  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/utils.rb    563 in `report_app_init_status'
15  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/rack/application_spawner.rb 154 in `initialize_server'
16  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb  204 in `start_synchronously'
17  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb  180 in `start'
18  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/rack/application_spawner.rb 129 in `start'
19  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb    253 in `block (2 levels) in spawn_rack_application'
20  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server_collection.rb   132 in `lookup_or_add'
21  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb    246 in `block in spawn_rack_application'
22  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server_collection.rb   82  in `block in synchronize'
23      prelude>    10:in `synchronize'
24  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server_collection.rb   79  in `synchronize'
25  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb    244 in `spawn_rack_application'
26  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb    137 in `spawn_application'
27  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/spawn_manager.rb    275 in `handle_spawn_application'
28  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb  357 in `server_main_loop'
29  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/lib/phusion_passenger/abstract_server.rb  206 in `start_synchronously'
30  /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/helper-scripts/passenger-spawn-server



软件版本




  • ruby​​ -v :ruby 1.9.3p327(2012-11-10修订版37606)[i686-linux]

  • rvm -v :rvm 1.17.2(稳定),作者:Wayne E. Seguin,Michal Papis [https://rvm.io/]

  • bundle -v :捆绑器版本1.2.3

  • capistrano :2.13.5

  • software versions

    • ruby -v: ruby 1.9.3p327 (2012-11-10 revision 37606) [i686-linux]
    • rvm -v: rvm 1.17.2 (stable) by Wayne E. Seguin , Michal Papis [https://rvm.io/]
    • bundle -v: Bundler version 1.2.3
    • capistrano: 2.13.5

      • 哪个红宝石:/home/hatd/.rvm/rubies/ruby-1.9.3-p327/bin/ruby

      • 哪个rvm :/home/hatd/.rvm/bin/rvm

      • 哪个捆绑:/home/hatd/.rvm/gems/ruby-1.9.3-p327@global/bin/bundle

      • which ruby: /home/hatd/.rvm/rubies/ruby-1.9.3-p327/bin/ruby
      • which rvm: /home/hatd/.rvm/bin/rvm
      • which bundle: /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/bin/bundle
      ruby-1.9.3-p327:
      
        system:
          uname:       "Linux hatd 3.2.0-23-generic-pae #36-Ubuntu SMP Tue Apr 10 22:19:09 UTC 2012 i686 i686 i386 GNU/Linux"
          system:      "ubuntu/12.04/i386"
          bash:        "/bin/bash => GNU bash, version 4.2.24(1)-release (i686-pc-linux-gnu)"
          zsh:         " => not installed"
      
        rvm:
          version:      "rvm 1.17.2 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]"
          updated:      "1 day 18 hours 3 minutes 27 seconds ago"
      
        ruby:
          interpreter:  "ruby"
          version:      "1.9.3p327"
          date:         "2012-11-10"
          platform:     "i686-linux"
          patchlevel:   "2012-11-10 revision 37606"
          full_version: "ruby 1.9.3p327 (2012-11-10 revision 37606) [i686-linux]"
      
        homes:
          gem:          "/home/hatd/.rvm/gems/ruby-1.9.3-p327"
          ruby:         "/home/hatd/.rvm/rubies/ruby-1.9.3-p327"
      
        binaries:
          ruby:         "/home/hatd/.rvm/rubies/ruby-1.9.3-p327/bin/ruby"
          irb:          "/home/hatd/.rvm/rubies/ruby-1.9.3-p327/bin/irb"
          gem:          "/home/hatd/.rvm/rubies/ruby-1.9.3-p327/bin/gem"
          rake:         "/home/hatd/.rvm/gems/ruby-1.9.3-p327@global/bin/rake"
      
        environment:
          PATH:         "/home/hatd/.rvm/gems/ruby-1.9.3-p327/bin:/home/hatd/.rvm/gems/ruby-1.9.3-p327@global/bin:/home/hatd/.rvm/rubies/ruby-1.9.3-p327/bin:/home/hatd/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"
          GEM_HOME:     "/home/hatd/.rvm/gems/ruby-1.9.3-p327"
          GEM_PATH:     "/home/hatd/.rvm/gems/ruby-1.9.3-p327:/home/hatd/.rvm/gems/ruby-1.9.3-p327@global"
          MY_RUBY_HOME: "/home/hatd/.rvm/rubies/ruby-1.9.3-p327"
          IRBRC:        "/home/hatd/.rvm/rubies/ruby-1.9.3-p327/.irbrc"
          RUBYOPT:      ""
          gemset:       ""
      



      Capistrano config / deploy.rb包含



      Capistrano config/deploy.rb contains

      require 'bundler/capistrano'
      



      .bundle / config内容



      .bundle/config contents

      ---
      BUNDLE_FROZEN: '1'
      BUNDLE_PATH: /var/www/3eadmin/shared/bundle
      BUNDLE_DISABLE_SHARED_GEMS: '1'
      BUNDLE_WITHOUT: development:test
      



      Gemfile内容:



      Gemfile contents:

      source 'https://rubygems.org'
      
      gem 'rails', '3.1.3'
      
      gem 'community_engine' , '2.0.0.beta4', :path => 'vendor/gems/community_engine-2.0.0.beta4'
      gem 'pg'
      gem 'json'
      gem 'jquery-rails'
      gem 'authority', '~> 2.0.0'
      gem 'friendly_id', '~> 3.3'
      gem 'hpricot'
      gem 'aws-sdk', '~> 1.3.4'
      gem 'bootstrap-sass', '~> 2.1.0.1'
      gem 'coffee-rails', '~> 3.1.1'
      gem 'rack-cors', :require => 'rack/cors'
      gem 'event-calendar', :require => 'event_calendar'
      gem 'apns'
      
      group :development do 
        gem 'sqlite3'
        gem 'rspec-rails', "~> 2.9.0"
        gem 'capistrano'
        gem 'rvm-capistrano'
        gem 'guard-rspec', "~> 0.7.0"
      end
      
      group :assets do
        gem 'sass-rails', '~> 3.1.4'
        gem 'uglifier', '>= 1.0.3'
      end
      
      group :test do
        gem 'rspec-rails', "~> 2.9.0"
        gem 'capybara', '~> 1.1.2'
        gem 'factory_girl_rails', '~> 3.2.0'
      end
      



      宝石列表输出



      gem list output

      *** LOCAL GEMS ***
      
      bundler (1.2.3)
      daemon_controller (1.1.0)
      fastthread (1.0.7)
      passenger (3.0.18)
      rack (1.4.1)
      rake (10.0.2)
      rubygems-bundler (1.1.0)
      rvm (1.11.3.5)
      



      捆绑列表输出



      bundle list output

      gems included by the bundle:
        * XMLCanonicalizer (1.0.1)
        * actionmailer (3.1.3)
        * actionpack (3.1.3)
        * activemodel (3.1.3)
        * activerecord (3.1.3)
        * activeresource (3.1.3)
        * activesupport (3.1.3)
        * acts_as_commentable (3.0.1)
        * addressable (2.2.8)
        * apns (0.9.0)
        * arel (2.2.3)
        * authlogic (3.1.3)
        * authority (2.0.0)
        * aws-sdk (1.3.9)
        * babosa (0.3.7)
        * bborn-acts-as-taggable-on (2.2.1)
        * bootstrap-sass (2.1.0.1)
        * builder (3.0.0)
        * bundler (1.2.3)
        * cocaine (0.3.0)
        * coffee-rails (3.1.1)
        * coffee-script (2.2.0)
        * coffee-script-source (1.3.1)
        * community_engine (2.0.0.beta4)
        * configatron (2.9.1)
        * dynamic_form (1.1.4)
        * erubis (2.7.0)
        * event-calendar (2.3.3)
        * execjs (1.3.2)
        * faraday (0.7.6)
        * friendly_id (3.3.3.0)
        * haml (3.1.7)
        * hike (1.2.1)
        * hpricot (0.8.6)
        * htmlentities (4.3.1)
        * httparty (0.8.3)
        * i18n (0.6.0)
        * jquery-rails (1.0.19)
        * json (1.7.1)
        * kaminari (0.14.0)
        * koala (1.4.0)
        * log4r (1.1.10)
        * macaddr (1.6.1)
        * mail (2.3.3)
        * meta_search (1.1.3)
        * mime-types (1.18)
        * multi_json (1.0.4)
        * multi_xml (0.4.4)
        * multipart-post (1.1.5)
        * net-ldap (0.2.2)
        * nokogiri (1.5.2)
        * oa-basic (0.3.2)
        * oa-core (0.3.2)
        * oa-enterprise (0.3.2)
        * oa-more (0.3.2)
        * oa-oauth (0.3.2)
        * oa-openid (0.3.2)
        * oauth (0.4.6)
        * oauth2 (0.5.2)
        * omniauth (0.3.2)
        * paperclip (2.7.0)
        * pg (0.13.2)
        * polyamorous (0.5.0)
        * polyglot (0.3.3)
        * prototype-rails (3.1.0)
        * pyu-ruby-sasl (0.0.3.3)
        * rack (1.3.6)
        * rack-cache (1.2)
        * rack-cors (0.2.7)
        * rack-mount (0.8.3)
        * rack-openid (1.3.1)
        * rack-ssl (1.3.2)
        * rack-test (0.6.1)
        * rails (3.1.3)
        * rails_autolink (1.0.9)
        * railties (3.1.3)
        * rake (0.9.2.2)
        * rakismet (1.3.0)
        * rdoc (3.12)
        * recaptcha (0.3.4)
        * rest-client (1.6.7)
        * ri_cal (0.8.8)
        * ruby-openid (2.2.0)
        * ruby-openid-apps-discovery (1.2.0)
        * rubyntlm (0.1.1)
        * sanitize (2.0.3)
        * sass (3.1.17)
        * sass-rails (3.1.4)
        * sprockets (2.0.4)
        * systemu (2.5.2)
        * thor (0.14.6)
        * tilt (1.3.3)
        * tinymce-rails (3.4.9)
        * treetop (1.4.10)
        * tzinfo (0.3.33)
        * uglifier (1.2.4)
        * uuid (2.3.5)
        * uuidtools (2.1.2)
        * yamler (0.1.0)
      



      乘客设置



      / etc / apache2 / mods-available / passenger.load



      Passenger Settings

      /etc/apache2/mods-available/passenger.load

      LoadModule passenger_module /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18/ext/apache2/mod_passenger.so
      


      PassengerRoot /home/hatd/.rvm/gems/ruby-1.9.3-p327@global/gems/passenger-3.0.18
      PassengerRuby /home/hatd/.rvm/wrappers/ruby-1.9.3-p327@global/ruby
      


      推荐答案

      好的,我希望对这个问题的答案可能更有启发性,但是可以这样:

      Okay, I wish the answer to this could have been something more illuminating, but here goes:

      生产服务器上安装的Bundler版本是1.2.3。开发机器上的版本是1.2.1。

      The Bundler version installed on the production server was 1.2.3. The version on my dev machine was 1.2.1.

      修复?

      gem uninstall bundler
      gem install bundler -v 1.2.1
      

      这种事情属于Bundler的问题页面,在此之后我会在此处正式发布。

      This sort of thing belongs on Bundler's issues page, where I will duly post right after this.

      这篇关于切换到Capistrano后,乘客在Rails应用上出现Bundler :: GemfileError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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