I'm trying to deploy a draft of my first Rails app. It works great on my local WEBRick server.
However, on my Ubuntu VPS running Apache2 & Passenger, when I navigate to the app in my browser, I get:
Error message:
no such file to load -- bundler/setup
Exception class:
LoadError
With the following backtrace:
0 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in `gem_original_require'
1 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in `require'
2 /home/user/public/foo.com/config/boot.rb 6
3 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in `gem_original_require'
4 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in `require'
5 /home/user/public/foo.com/config/application.rb 1
6 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in `gem_original_require'
7 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in `require'
8 /home/user/public/foo.com/config/environment.rb 2
9 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in `gem_original_require'
10 /usr/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb 36 in `require'
11 config.ru 3
12 /usr/lib/ruby/vendor_ruby/rack/builder.rb 51 in `instance_eval'
13 /usr/lib/ruby/vendor_ruby/rack/builder.rb 51 in `initialize'
14 config.ru 1 in `new'
15 config.ru 1
The app was built with Ruby v1.9.3 (or so I thought), which I've installed on Ubuntu (in the app root, ruby -v
returns ruby 1.9.3p286 (2012-10-12 revision 37165) [i686-linux]
).
As per this question, I've run gem install bundle
and bundle install
in the app root. I've also imported the correct gemset
from my local machine to the VPS app root.
As per this question, I attempted to change the gem set to /home/user/.rvm/gems/ruby-1.9.3-p286@foo
(where foo is that name of the gemset in use), but this just made the backtrace longer.
Any help further troubleshooting this would be much appreciated!
EDIT: I finally got my app functioning by uninstalling Rails, RVM, Ruby (an RVM version) & Passenger before reinstalling Rails, Passenger & Ruby (but not RVM).
Try setting GEM_HOME on your virtual host's config file:
The problem seems to be that when you execute
bundle install
it uses the rvm ruby whilst when you execute passenger it still uses the ruby 1.8How to set the correct value
If you are not sure what value to set passenger_ruby to, then you can find out the correct value as follows.
First, find out the location to the passenger-config tool and take note of it:
Next, activate the Ruby interpreter (and if applicable, the gemset) you want to use. For example, if you are on RVM and you use Ruby 2.2.1, you may want to run this:
Finally, invoke passenger-config with its full path, passing --ruby-command as parameter:
The output tells you what value to set.
Now goto passenger.conf in /etc/apache2/mods-available directory and paste required lines shown above.
Now execute following commands and it worked for me,
Did you change the
/etc/apache2/mods-available/passenger.conf
to change the paths to ruby 1.9.3?Don't forget the
a2dismod passenger
anda2enmod passenger
once you do that.