Error Running Rails 3 Application under Phusion Passenger

I have a rails 3 application that runs without problems under WebRick (on Ubuntu) that generates the following error in the browser when I run under Apache2 with Phusion Passenger:

Ruby (Rack) application could not be started

Error message:

    no such file to load -- bundler

Exception class:

    LoadError

I have googled and found one or two posts with this problem but none with solutions.

Backtrace:

   lib/rubygems/custom_require> 29:in `require'      lib/rubygems/custom_require> 29:in `require'    /usr/lib/ruby/gems/1.9.0/gems/passenger-2.2.15/lib/phusion_passenger/utils.rb 221 in `setup_bundler_support'    /usr/lib/ruby/gems/1.9.0/gems/passenger-2.2.15/lib/phusion_passenger/rack/application_spawner.rb 105 in `block in run' ... ..

I tried installing the bundler gem but that didn't change anything.

Any suggestions?

Thanks

It means you need to install Bundler.

Hongli Lai wrote:

It means you need to install Bundler.

I tried installing the bundler gem but that didn't change anything.

So if by this you mean something different or there is something additional I need to do please specify.

Thanks

Oops, sorry, totally looked over that part.

The most likely scenario is that you have multiple Ruby interpreters installed on your system. Let's call them Ruby A and Ruby B. When you type 'gem install bundler' you probably installed Bundler into Ruby A, but you told Phusion Passenger to use Ruby B and so the gem installation didn't have any effect on Phusion Passenger. Tell Phusion Passenger to use Ruby A, or install Bundler into Ruby B.

Or, you installed Bundler without 'sudo' and caused it to be installed into $HOME instead of system-wide.

Hongli Lai wrote:

The most likely scenario is that you have multiple Ruby interpreters installed on your system.

Yea I definitely had some Ruby version hell going on.

Thanks for pointing me in the right direction.

Mark