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.
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
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
.
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 ;)
我不知道为什么,但我在Global Gemset中安装了缺少的宝石,它可以工作!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.