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

ぃ、小莉子 提交于 2019-12-11 03:05:49

问题


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.


回答1:


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




回答2:


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.




回答3:


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 ;)




回答4:


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



来源:https://stackoverflow.com/questions/4798645/rvm-ruby-1-9-2-rails-3-passenger-3-0-2-bundlergemnotfound

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!