gpt4 book ai didi

ruby-on-rails - rake 中止!未定义的方法 `each' 为零 :NilClass

转载 作者:行者123 更新时间:2023-12-04 18:52:35 27 4
gpt4 key购买 nike

每次运行“sudo bundle exec rake snorby:setup”时都会出现此错误。

另外,我对此很陌生,无法弄清楚我做错了什么。请让我知道是否需要更多信息才能充分回答问题。

完整跟踪:

ciscadet@farnsworth:/var/www/snorby$ sudo bundle exec rake snorby:setup
No time_zone specified in snorby_config.yml; detected time_zone: US/Eastern
rake aborted!
undefined method `each' for nil:NilClass

Tasks: TOP => snorby:setup => environment
(See full trace by running task with --trace)
ciscadet@farnsworth:/var/www/snorby$ sudo bundle exec rake snorby:setup --trace
No time_zone specified in snorby_config.yml; detected time_zone: US/Eastern
** Invoke snorby:setup (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `each' for nil:NilClass
/var/www/snorby/vender/cache/ruby/1.9.1/gems/dm-rails-1.2.1/lib/dm-rails/setup.rb:11:in `setup'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/dm-rails-1.2.1/lib/dm-rails/railtie.rb:90:in `block in <class:Railtie>'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/lazy_load_hooks.rb:34:in `call'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/lazy_load_hooks.rb:42:in `each'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/railties-3.1.12/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/railties-3.1.12/lib/rails/initializable.rb:30:in `instance_exec'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/railties-3.1.12/lib/rails/initializable.rb:30:in `run'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/railties-3.1.12/lib/rails/initializable.rb:55:in `block in run_initializers'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/railties-3.1.12/lib/rails/initializable.rb:54:in `each'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/railties-3.1.12/lib/rails/initializable.rb:54:in `run_initializers'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/railties-3.1.12/lib/rails/application.rb:96:in `initialize!'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/railties-3.1.12/lib/rails/railtie/configurable.rb:30:in `method_missing'
/var/www/snorby/config/environment.rb:3:in `<top (required)>'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:240:in `require'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:240:in `block in require'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:640:in `new_constants_in'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:223:in `load_dependency'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/activesupport-3.1.12/lib/active_support/dependencies.rb:240:in `require'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/railties-3.1.12/lib/rails/application.rb:83:in `require_environment!'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/railties-3.1.12/lib/rails/application.rb:203:in `block (2 levels) in initialize_tasks'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `call'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `each'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in `each'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `each'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:84:in `top_level'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:62:in `block in run'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:129:in `standard_exception_handling'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:59:in `run'
/var/www/snorby/vender/cache/ruby/1.9.1/gems/rake-0.9.2/bin/rake:32:in `<top (required)>'
/var/www/snorby/vender/cache/ruby/1.9.1/bin/rake:23:in `load'
/var/www/snorby/vender/cache/ruby/1.9.1/bin/rake:23:in `<main>'
Tasks: TOP => snorby:setup => environment

最佳答案

没有方法

错误在这里:

No time_zone specified in snorby_config.yml; detected time_zone: US/Eastern rake aborted!


no method error基本上意味着你正在调用的对象 .each不存在。大多数人认为问题在于方法调用,但事实恰恰相反——缺少 object
解决此问题的方法是确保您的 object被定义为。通常,您可以通过定义相关的 @instance variable 来实现此目的。 ;但是,您当前的问题似乎是 snorby_config.yml
--

snorby_config.yml

根据他们的 github example - snorby_config.yml ,您应该将其填充到 config/snorby_config.yml
查看您的错误日志,Rails 似乎无法调用 snorby:setup ,从而导致您看到的另一个错误。要解决此问题,您需要确保已设置 snorby正确:
$ rake snorby:setup

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

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