Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/60.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 乘客错过生产环境中的发展宝石_Ruby On Rails_Gem_Passenger_Bundler_Environment - Fatal编程技术网

Ruby on rails 乘客错过生产环境中的发展宝石

Ruby on rails 乘客错过生产环境中的发展宝石,ruby-on-rails,gem,passenger,bundler,environment,Ruby On Rails,Gem,Passenger,Bundler,Environment,我在生产服务器上有一个奇怪的行为:我通过Capistrano将Rails 3应用程序部署到生产服务器上。Capistrano脚本在部署结束时重新启动乘客。当我打开应用程序时,会看到一条乘客错误消息: Could not find autotest-fsevent-0.2.4 in any of the sources (Bundler::GemNotFound) 当然,autotest fsevent没有安装在我的生产环境中(甚至不能安装在Ubuntu上…) 环境是在apache的virtua

我在生产服务器上有一个奇怪的行为:我通过Capistrano将Rails 3应用程序部署到生产服务器上。Capistrano脚本在部署结束时重新启动乘客。当我打开应用程序时,会看到一条乘客错误消息:

Could not find autotest-fsevent-0.2.4 in any of the sources
(Bundler::GemNotFound)
当然,autotest fsevent没有安装在我的生产环境中(甚至不能安装在Ubuntu上…)

环境是在apache的virtualhost中设置的:

<VirtualHost *>
  PassengerMinInstances 1

  ServerName test.myapp.de
  DocumentRoot /var/www/myapp/current/public

  RailsEnv production
  RackEnv production

  <Directory /var/www/myapp/current/public/>
    Options -Indexes
    AllowOverride None
    Order deny,allow
    Deny from none
    Allow from all
    AddOutputFilterbyType DEFLATE text/html
    FileEtag none
  </Directory>

  LogLevel warn
  ErrorLog /var/www/myapp/shared/log/error.log
  CustomLog /var/www/myapp/shared/log/access.log combined

</VirtualHost>
为什么passenger(或bundler)认为它需要所有的gem,而只需要生产环境的gem


谢谢你的帮助

您的
RAILS\u ENV
环境变量可能未定义,或者无意中设置为
development
,这可能会导致加载错误的gem集。您可能需要深入查看
deploy.rb
脚本,以确保设置了正确的环境

deploy.rb中应该有类似的内容:

task :production do
  # ...

  set :rails_env, 'production'

  # ...
end
通过执行以下操作,您应该能够验证此设置是否正确:

cap production shell
cap> echo $RAILS_ENV
** [out :: myserver] production

您是否使用bundler capistrano配方

确保这在您的
config/deploy.rb中

require 'bundler/capistrano'

基本上,它将使用
——而不使用developmenttest
选项调用bundle,该选项只应安装生产gems。如果您只是在做一个常规的
捆绑包
,它将安装并尝试为所有环境安装gems。

好的,我将它添加到了我的deploy.rb中。部署过程现在根本不起作用,我想是因为我的Gemfile(geokit-rails3)中有一个git引用的gem。由于这个gem现在也可以在rubygems上使用,所以我删除了github引用和TADA:我的部署过程又开始工作了。谢谢你的帮助!:-)
require 'bundler/capistrano'