Harry
Harry

Reputation: 641

RVM, Ruby 1.9.2, Rails 3, Passenger 3.0.2 (Bundler::GemNotFound)

I'm using RVM, Ruby 1.9.2, Rails 3, Passenger 3.0.2 configured for Nginx, I setup server configuration correctly. Another app working so far.

But for the new app, when booting server

http://myapp.local (its configured with hosts to point server bind on Nginx conf) It returns (Bundler::GemNotFound) error. How to get around this?

Thanks.

Upvotes: 2

Views: 11398

Answers (4)

Evgeniya Manolova
Evgeniya Manolova

Reputation: 2650

For rvm based apps and Passenger, you may refer to these docs:

https://rvm.io/integration/passenger http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerRuby

My particular problem was that I didn't have the passenger gem installed in the current gemset:

$ gem list --local |grep passenger # returns nothing

To install the plugin and the Apache module, I've executed the following sequence of commands:

$ gem install passenger # for a specific version use the '--version' flag
$ gem list --local |grep passenger
passenger (4.0.18)
$ passenger-install-apache2-module

After the installation the script printed instructions how to set the PassengerDefaultRuby variable in Apache's config. Voilà! - no extra scripts and LOAD_PATH manipulation ;)

Upvotes: 0

defmsy
defmsy

Reputation: 1

I don't know why, but I installed the missing Gem in Global Gemset and it works!

Upvotes: -2

Marius Butuc
Marius Butuc

Reputation: 18280

For a clearer and up to date solution, check out the official docs page on using RVM rubies with Passenger.

For the gist of it, add

if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
  begin
    gems_path = ENV['MY_RUBY_HOME'].split(/@/)[0].sub(/rubies/,'gems')
    ENV['GEM_PATH'] = "#{gems_path}:#{gems_path}@global"
    require 'rvm'
    RVM.use_from_path! File.dirname(File.dirname(__FILE__))
  rescue LoadError
    raise "RVM gem is currently unavailable."
  end
end

# If you're not using Bundler at all, remove lines bellow
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__))
require 'bundler/setup'

to your <rails-app-path>/config/setup_load_paths.rb.

Upvotes: 0

ChuckJHardy
ChuckJHardy

Reputation: 7066

Believe it or not this is a very common problem most Rails Developers will come across. Have a look at this post which details the fix I think you are looking for. Best of luck. http://dalibornasevic.com/posts/21-rvm-and-passenger-setup-for-rails-2-and-rails-3-apps

Upvotes: 13

Related Questions