No such file to load bundler error for Rails 3
Asked Answered
H

6

8

I have a Rails 3 app ready for staging.

I haven't got a VPS host set up yet. As I was planning to have everything on shared host for the first few months.

Problem:

cd myapp bundle check result:

The Gemfile's dependencies are satisfied

Passenger error:

Error message:
    no such file to load -- bundler
Exception class:
    LoadError

Frustrating thing about shared hosts is that I have to add these lines on config.ru:

ENV['GEM_HOME'] = '/home/username/.gems'
ENV['GEM_PATH'] = '$GEM_HOME:/usr/lib/ruby/gems/1.8'

Still no luck. Same no such file to load bundler error appears.

Has anybody got this working? Rails 3, Debian, shared host (dreamhost)?

I could just go ahead and register on Slicehost/Fivebean but before I do, I'd like to know why that error is showing up.

Thanks.

Hager answered 3/4, 2010 at 7:6 Comment(1)
Try chmod a+rx /usr/local/rvm/ -RDenticulation
R
9

The solution is here http://rvm.beginrescueend.com/integration/passenger/. You need to point your HTTP server to passenger_ruby wrapper instead of bin/ruby.

E.g. for RVM & Apache it should be something like that:

PassengerRuby /Users/username/.rvm/bin/passenger_ruby
Rocaille answered 29/4, 2010 at 16:33 Comment(2)
Then why does it say on that page "Please note that for Passenger 3 you now use the ruby wrapper script directly with no need to use the passenger_ruby wrapper."?Chalet
Does this solution require root access?Counterclaim
S
4

Passenger doesn't read environment variables from config.ru until after it has loaded. Without your backtrace I can't be positive, but I suspect everything will work if you just run bundle lock. If you're still having trouble after that, there's a list of troubleshooting information at the bottom of the bundler README that I need to know exactly what's going on.

Schizothymia answered 3/4, 2010 at 16:40 Comment(0)
D
3

Rails hosting on shared hosts is already a minefield, but throwing in Rails 3 in all its pre-release goodness including Bundler reinventing the rubygems workflow is a recipe for pulling your hair out.

I host a few Rails sites on Dreamhost, but only the versions they officially support, otherwise it's just not worth the time. You can get a VPS now for almost as cheap as Dreamhost, and you will save hours and hours of your own time.

If you're looking for an easy answer, I'd suggest voting up the following and crossing your fingers:

Rails 3 on dreamhost?

Demonolater answered 3/4, 2010 at 7:29 Comment(1)
AH yeah... Fivebean. Hope to deploy soon. Dreamhost sucks.Hager
H
2

For me, this turned out to be an issue with the passenger_ruby directive that passenger-install-nginx-module spits out at the end of installation. It was missing the gemset name in the path to the ruby.

This works: (the fix)

passenger_ruby /Users/dzello/.rvm/wrappers/ruby-1.9.2-p0@rails3/ruby;

This did not: (what passenger-install-nginx-module spits out)

passenger_ruby /Users/dzello/.rvm/rubies/ruby-1.9.2-p0/bin/ruby

Note the passenger_ruby line does not include the proper gem path - the @rails3 (rails3 is the gemset name) portion is missing, even though it got it right for passenger root.

Hierophant answered 2/2, 2011 at 7:32 Comment(2)
Also - the ruby is in /wrappers now, not /rubies ... that one caught me outBecause
The fact that this needed to be done and the wrong directive being spit out by the script is a bit infuriating.Flesh
D
0

Found some random blog. It had some lines that went in 'config.ru', that seemed to work for me.

ENV['GEM_HOME'] = '/home/farleyknight/.gems'
ENV['GEM_PATH'] = '$GEM_HOME:/usr/lib/ruby/gems/1.8'
require 'rubygems'
Gem.clear_paths

Maybe it will work for you..

Dissolve answered 27/4, 2010 at 22:8 Comment(2)
it didn't work here. I voted down because of a typo. ENV['GEM_PATH'] line should read like this: ENV['GEM_PATH'] = "#{ENV['GEM_HOME']}:/usr/lib/ruby/gems/1.8"Mort
$: << "/usr/lib/ruby/gems/1.8/gems/bundler-0.9.26/lib", on the other hand, did work for me :SMort
R
0

I had this problem with vps plus rvm, rails3, capistrano and nginx.

Passenger was installed by root but the web site was installed by user fox. Nginx (root) was configured to run the app as fox. When logged in as fox, Bundler was installed but running gem list bundler as root showed no gem.

Passenger start would give error bundler was missing. Only cure for this was to install bundler as root AND fox. I'm guessing passenger checks for bundler while not under the user fox as configured in nginx.

Referee answered 14/4, 2011 at 2:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.