Rails 3: Passenger can't find git gems installed by bundler

前端 未结 6 2002
伪装坚强ぢ
伪装坚强ぢ 2020-12-07 09:41

Rails 3.0.0, Passenger 2.2.15:

  • Create a new Rails project
  • Add gem \'paperclip\', :git => \'git://github.com/lmumar/paperclip.git\', :branch =
相关标签:
6条回答
  • 2020-12-07 09:53

    I installed the passenger gem and its apache module as a sudo user and that was the problem in my case.

    The reason why I used sudo initially was that I copied the code from railscasts' episode 122. Installing it without sodu access resolved this issue. Since Ruby was installed using rvm without the sudo access on my system.

    0 讨论(0)
  • 2020-12-07 09:56

    You can use bundle install --path vendor/bundle to install the gems locally, instead of into system gems.

    If you want to keep using system gems, though, it's just one line in your Apache configuration to tell Passenger where to find your system gems:

    SetEnv GEM_HOME /Users/bob/.bundle
    

    There's a slightly more elaborate writeup on my blog at Using Passenger with GEM_HOME set

    0 讨论(0)
  • 2020-12-07 10:00

    I had the same problem and it was due to a rights issue with RVM.

    The user that run the web server can not check if GIT gem is available. As "Passenger" using the web user to run, it can not do this check.

    The solution I found was to add web user to rvm group:

    usermod -a -G rvm apache
    

    I hope this will help some other people that don't want to have GEM deployed into "vendor/bundle".

    0 讨论(0)
  • 2020-12-07 10:01

    Im used to have this problem, resolve using

    bundle --deployment
    

    Which will install the gems in vendor/bundle

    0 讨论(0)
  • 2020-12-07 10:10

    Solution (took me a few hours):

    Mare sure that RAILS_ROOT/.bundle/config (SetEnv etc. didn't work for me) contains:

    --- 
    BUNDLE_PATH: /home/xxxxx/.bundler
    

    Note BUNDLE_PATH, not BUNDLER_PATH! There was also an DISABLED_SHARED_GEMS=1 entry, I removed it.

    Then bundler recognises the correct path even when loaded from Passenger. Without Passenger, it always worked (and used /home/xxxxx/.bundler, as said in the question)

    0 讨论(0)
  • 2020-12-07 10:12

    I ran into this problem while writing a Sinatra app. To solve it I added this line to config.ru.

    require 'bundler/setup'
    
    0 讨论(0)
提交回复
热议问题