rake: NameError: uninitialized constant Config

rake: NameError: uninitialized constant Config

我正在安装 Redmine,但由于佣金问题,我快疯了。特别是,为了对不同的 Ruby 插件执行捆绑安装,我被要求安装 xapian-full-alaveteli,v 1.2.9.5。 问题是我收到以下错误:

Building native extensions.  This could take a while...
ERROR:  Error installing xapian-full-alaveteli:
ERROR: Failed to build gem native extension.

/home/redmine/.rvm/rubies/ruby-2.2.0/bin/ruby -rubygems /home/redmine/.rvm/rubies/ruby-2.2.0/lib/ruby/gems/2.2.0/gems/rake-10.4.2/bin/rake RUBYARCHDIR=/home/redmine/.rvm/gems/ruby-2.2.0/extensions/x86_64-linux/2.2.0/xapian-full-alaveteli-1.2.9.5 RUBYLIBDIR=/home/redmine/.rvm/gems/ruby-2.2.0/extensions/x86_64-linux/2.2.0/xapian-full-alaveteli-1.2.9.5
rake aborted!
NameError: uninitialized constant Config
/home/redmine/.rvm/gems/ruby-2.2.0/gems/xapian-full-alaveteli-1.2.9.5/Rakefile:2:in `<top (required)>'
(See full trace by running task with --trace)

rake failed, exit code 1

Gem files will remain installed in /home/redmine/.rvm/gems/ruby-2.2.0/gems/xapian-full-alaveteli-1.2.9.5 for inspection.
Results logged to /home/redmine/.rvm/gems/ruby-2.2.0/extensions/x86_64-linux/2.2.0/xapian-full-alaveteli-1.2.9.5/gem_make.out

我试过手动编辑 rakefile 并删除导致问题的行,但它神奇地重新出现了。关于使用 rake/gem 的文档,恕我直言,至少是模糊的,因此我完全被困住了——两天前应该在生产中的服务器...

总结

对 Config 的过时调用可能会导致错误。尝试更改

Config::CONFIG    ====>    RbConfig::CONFIG

详细

运行 Gem 的 rakefile 导致错误:未初始化的常量配置。

谷歌搜索建议 Config is obsolete and to replace it with RbConfig. RbConfig is in the latest Ruby though the document is blank and I cannot find a Config in Ruby

修复了用 RbConfig 替换 Config:gettalong/kramdown and thoughtbot/cocaine。这也适用于我的情况。

结论

Config::CONFIG替换为RbConfig::CONFIG