[英]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. 我正在使用为Nginx配置的RVM,Ruby 1.9.2,Rails 3,Passenger 3.0.2,我正确设置了服务器配置。 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. http://myapp.local (它配置了主机指向Nginx conf上的服务器绑定)它返回(Bundler :: GemNotFound)错误。 How to get around this?
怎么解决这个问题?
Thanks. 谢谢。
Believe it or not this is a very common problem most Rails Developers will come across. 信不信由你,大多数Rails开发人员都会遇到这个问题。 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
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 . 有关更清晰和最新的解决方案,请查看有关使用RAV红宝石与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
. 到你的
<rails-app-path>/config/setup_load_paths.rb
。
For rvm based apps and Passenger, you may refer to these docs: 对于基于rvm的应用程序和Passenger,您可以参考以下文档:
https://rvm.io/integration/passenger http://www.modrails.com/documentation/Users%20guide%20Apache.html#PassengerRuby 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: 我特别的问题是我没有在当前gemset中安装乘客gem:
$ gem list --local |grep passenger # returns nothing
To install the plugin and the Apache module, I've executed the following sequence of commands: 要安装插件和Apache模块,我执行了以下命令序列:
$ 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. 安装后,脚本打印指示如何在Apache的配置中设置PassengerDefaultRuby变量。 Voilà!
瞧! - no extra scripts and LOAD_PATH manipulation ;)
- 没有额外的脚本和LOAD_PATH操作;)
我不知道为什么,但我在Global Gemset中安装了缺少的宝石,它可以工作!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.