gpt4 book ai didi

ruby-on-rails - rake 中止!未定义方法 `prerequisites' 为 nil :NilClass

转载 作者:数据小太阳 更新时间:2023-10-29 07:34:45 25 4
gpt4 key购买 nike

剧透:它是 rspec-rails gem 的过时版本!

在将我的 sqlite3 gem 移动到开发 block 中然后运行“rake db:migrate”以确保一切正常后,从我的 rails 项目目录发出的任何 rake 命令都遇到了这个错误。 Rake 在我系统的其他地方工作正常。但是我在该目录中运行的任何 rake 任务都会给我以下带有跟踪的输出:

/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec/rails/tasks/rspec.rake:3:in `<top (required)>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:8:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rspec-rails-2.0.0.beta.18/lib/rspec-rails.rb:8:in `block in <class:Railtie>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `call'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `block in load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `each'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie.rb:183:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/engine.rb:396:in `block in load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `each'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application/railties.rb:8:in `all'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/engine.rb:396:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/application.rb:103:in `load_tasks'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Users/ianyoung/rails/third_app/Rakefile:7:in `<top (required)>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/Users/ianyoung/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'

我得到的第一个错误是问题标题: rake 中止! nil:NilClass 的未定义方法“先决条件”

我也遇到过这个问题,但它并没有给我带来问题。也许它是相关的?:

DEPRECATION WARNING: config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead. (called from at /Users/ianyoung/rails/third_app/config/application.rb:13) DEPRECATION WARNING: config.generators in Rails::Railtie is deprecated. Please use config.app_generators instead. (called from at /Users/ianyoung/rails/third_app/config/application.rb:13)

最佳答案

更新到最新的 rspec-rails gem 让我摆脱了这个问题和弃用警告。

安装最新的 webrat gem 解决了缺少的 has_selector?我出于某种原因认为的方法问题比我过时的 rspec-rails gem 更邪恶。一切都很好。

感谢您提供有用的评论。

关于ruby-on-rails - rake 中止!未定义方法 `prerequisites' 为 nil :NilClass,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8858432/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com