无法运行 grack,passenger 发生错误:未初始化常量 GitHttp (NameError)”

无法运行 grack,passenger 发生错误:未初始化常量 GitHttp (NameError)”

我尝试设置 Web 服务器,以便在成功安装并运行的 Redmine 服务器上发布 git 存储库。

乘客发生错误:无法启动 Web 应用程序

uninitialized constant GitHttp (NameError) config.ru:16:in block in <main>' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:ininstance_eval' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/rack-1.5.2/lib/rack/builder.rb:55:in initialize' config.ru:1:innew' config.ru:1:in <main>' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:105:ineval' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:105:in preload_app' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:150:in' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:29:in <module:PhusionPassenger>' /usr/local/rvm/gems/ruby-2.0.0-p247/gems/passenger-4.0.18/helper-scripts/rack-preloader.rb:28:in'

/usr/local/rvm/wrappers/ruby-2.0.0-p247/ruby

答案1

GitHttpgrack 发布版本中的一个类(最后一个是 0.2)在项目的 git master 分支中不再存在。

我怀疑你更新了 grack 代码到 master HEAD 却没有更新config.ru。你的config.rufor master 应该像这样,项目路径已替换:

$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/lib')

use Rack::ShowExceptions

require 'grack'
require 'git_adapter'

config = {
  :project_root => "/path/to/your/repos/",
  :adapter => Grack::GitAdapter,
  :git_path => '/usr/bin/git',
  :upload_pack => true,
  :receive_pack => true,
}

run Grack::App.new(config)

相关内容