【问题标题】:undefined method `searcher' for Gem:ModuleGem:Module 的未定义方法“searcher”
【发布时间】:2013-03-27 03:20:51
【问题描述】:

我在运行bundle exec rake db:initial_setup时,出现错误:

rake 中止! Gem:Module 的未定义方法“searcher”。

我该如何解决这个问题?

这是 bundle exec rake db:initial_setup --trace 的输出

rake aborted!
undefined method `searcher' for Gem:Module
/home/jesse/workspace/canvas/lib/tasks/hair_trigger.rake:2:in `<top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:171:in `load'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:171:in `block in load_with_new_constant_marking'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:547:in `new_constants_in'
/usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.17/lib/active_support/dependencies.rb:171:in `load_with_new_constant_marking'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.17/lib/tasks/rails.rb:14:in `block in <top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.17/lib/tasks/rails.rb:14:in `each'
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.17/lib/tasks/rails.rb:14:in `<top (required)>'
/home/jesse/workspace/canvas/Rakefile:10:in `require'
/home/jesse/workspace/canvas/Rakefile:10:in `<top (required)>'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.6/lib/rake/rake_module.rb:25:in `load'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.6/lib/rake/rake_module.rb:25:in `load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:604:in `raw_load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:89:in `block in load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:160:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:88:in `load_rakefile'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:72:in `block in run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:160:in `standard_exception_handling'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.6/lib/rake/application.rb:70:in `run'
/usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.6/bin/rake:37:in `<top (required)>'
/usr/local/bin/rake:23:in `load'
/usr/local/bin/rake:23:in `<main>'

有什么建议吗?

谢谢!

【问题讨论】:

  • 运行 rake--trace 以获得完整的堆栈跟踪,然后将输出发布到此处。
  • 这里是输出:rake aborted!您已经激活了 rake 10.0.3,但您的 Gemfile 需要 rake 0.9.6。使用 bundle exec 可以解决这个问题。所以我只使用不带 rake 的 bundle exec?

标签: ruby rake


【解决方案1】:

这是因为 Gem.searcher 已被弃用,看来您最近更新了 ruby​​ gems。 使用命令检查您的版本

$ gem -v

您可以使用命令返回任何旧版本

$ rvm rubygems 1.8.24

【讨论】:

    猜你喜欢
    • 2013-09-28
    • 2013-02-27
    • 1970-01-01
    • 2017-01-20
    • 1970-01-01
    • 2013-12-12
    • 2016-10-14
    • 1970-01-01
    • 2013-10-20
    相关资源
    最近更新 更多