Rails Commands Hanging with Webpacker - ruby-on-rails

I'm trying to create a new Rails 6 app on Windows 10 machine. However, when I try to run anything rails or rake commands, it hangs/freezes. I discovered that it was tied to Webpacker when I was creating my DB.
C:\Sites\myapp> bundle exec rake db:migrate --trace
When I terminated the job, it showed this:
rails aborted!
Interrupt:
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:33:in ``'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:33:in `block in <class:Engine>'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:32:in `instance_exec'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:32:in `run'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:61:in `block in run_initializers'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:347:in `each'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:347:in `call'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
C:/tools/ruby26/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/initializable.rb:60:in `run_initializers'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/application.rb:362:in `initialize!'
C:/Sites/highbar/config/environment.rb:5:in `<top (required)>'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/zeitwerk-2.1.6/lib/zeitwerk/kernel.rb:23:in `require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/zeitwerk-2.1.6/lib/zeitwerk/kernel.rb:23:in `require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `block in require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:268:in `load_dependency'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `require'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/application.rb:338:in `require_environment!'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/application.rb:514:in `block in run_tasks_blocks'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:238:in `block in invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:238:in `block in invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `invoke_prerequisites'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/command.rb:48:in `invoke'
C:/tools/ruby26/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:create => db:load_config => environment
When I comment out Webpacker in the gemfile, this worked, as did rails s. As soon as I uncomment Webpacker, the commands freeze/hang again.
Is there anything that I need to do beyond bundle exec rails webpacker:install?

My version of NodeJS was out of date. When I updated NodeJS, I also needed to update Yarn. After doing that, I'm able to run Rails 6 with Webpacker.

Related

Ruby On Rails - NoMethodError: undefined method `[]' for nil:NilClass

I'm trying to run on a new computer some ruby code and I receive the following error (rails db:migrate --trace)
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
rails aborted!
NoMethodError: undefined method `[]' for nil:NilClass
/Users/jairochavez/Documents/Rails/rfdf_bolivia/config/initializers/stripe.rb:2:in `<main>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `block in load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:285:in `load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:657:in `block in load_config_initializer'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb:170:in `instrument'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:656:in `load_config_initializer'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:614:in `block (2 levels) in <class:Engine>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/engine.rb:613:in `block in <class:Engine>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:50:in `tsort_each_child'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:415:in `call'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `call'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
/Users/jairochavez/Documents/Rails/rfdf_bolivia/config/environment.rb:5:in `<main>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/application.rb:520:in `block in run_tasks_blocks'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:238:in `block in invoke_prerequisites'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `invoke_prerequisites'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:238:in `block in invoke_prerequisites'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:236:in `invoke_prerequisites'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:213:in `block in invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/command.rb:48:in `invoke'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<main>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
/Users/jairochavez/Documents/Rails/rfdf_bolivia/bin/rails:9:in `<top (required)>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/client/rails.rb:28:in `call'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/bin/spring:49:in `<top (required)>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `load'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/spring-2.0.2/lib/spring/binstub.rb:31:in `<top (required)>'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/jairochavez/.rbenv/versions/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Users/jairochavez/Documents/Rails/rfdf_bolivia/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment
config/initializers/stripe.rb
Rails.configuration.stripe = {
publishable_key: Rails.application.credentials[Rails.env.to_sym][:stripe][:public_key],
secret_key: Rails.application.credentials[Rails.env.to_sym][:stripe][:secret_key]
}
Stripe.api_key = Rails.configuration.stripe[:secret_key]
From the stacktrace you posted, this line in particular appears to be the issue:
Rails.application.credentials[Rails.env.to_sym][:stripe][:public_key]
Since you're chaining multiple hash accesses, one of those objects is nil. You could try inspecting each of them by adding something like this to the top of the initializer:
puts Rails.application.credentials.inspect
puts Rails.application.credentials[Rails.env.to_sym].inspect
puts Rails.application.credentials[Rails.env.to_sym][:stripe].inspect
That will tell you which part is nil that shouldn't be, and you can update your credentials file accordingly.
Based on your configuration you should have your credentials.yml looking something like this:
stripe:
secret_key: pk_123456789012345
public_key: sk_abcdefghijklnmk
In your stripe.rb you missed [:secret_key]. It should look like this. But this won't work either when you are precompiling in production.
Stripe.api_key = Rails.application.credentials[Rails.env.to_sym][:stripe][:secret_key]
Use dig method instead.
So for your stripe.rb
Stripe.api_key = Rails.application.credentials.dig(:stripe, :secret_key)
In your terminal run
RAILS_ENV=production rails c
In the console run
Rails.application.credentials.dig(:stripe, :secret_key)
Now you should get a value.
This was an issue I ran into and suffered until I figure it out. It seems to be an issue with rails code base. Not sure we need to load credentials to compile assets. Anyways, they close this issue but I am not sure why they closed it. Here is the link to the issue. https://github.com/rails/rails/issues/32947
When cloning an existing repo, you might run into this error if you do not have a config/master.key file, (which is not checked in to source control, e.g. GitHub). This is because, as #Elias Glyptis pointed out, credentials are needed to compile assets, (as documented in Rails #32947).
config/initializer/stripe.rb
Stripe.api_key = Rails.application.credentials.dig(Rails.env.to_sym, :stripe, :secret)

skipping initializer in development enviroment rails

When ever, I perform a rails test in cmd line, or rails db:migrate RAILS_ENV=test I keep getting a NoMethodError for my omniauth initialzer although the rails server works fine and so does, omniauth on my, heroku site where my code is pushed to. I read this question Rails: Per-environment initializers? and added if Rails.env.production? at the top of my omniauth initialzer file so to run the omniauth initialzer only for production but I am having no luck.
The full error is;
db:migrate RAILS_ENV=test --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rails aborted!
NoMethodError: undefined method `[]' for nil:NilClass
C:/Sites/Peoples_Profiles/config/initializers/omniauth.rb:5:in `block in <top (required)>'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/omniauth-1.3.1/lib/omniauth/builder.rb:6:in `initialize'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:35:in `new'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:35:in `build'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:100:in `block in build'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:100:in `each'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:100:in `inject'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/stack.rb:100:in `build'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:508:in `block in app'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:504:in `synchronize'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/engine.rb:504:in `app'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/application/finisher.rb:37:in `block in <module:Finisher>'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `instance_exec'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:30:in `run'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `each'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `call'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/initializable.rb:54:in `run_initializers'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/application.rb:352:in `initialize!'
C:/Sites/Peoples_Profiles/config/environment.rb:5:in `<top (required)>'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `block in require'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:259:in `load_dependency'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.1/lib/active_support/dependencies.rb:293:in `require'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/application.rb:328:in `require_environment!'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/application.rb:448:in `block in run_tasks_blocks'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:248:in `call'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:248:in `block in execute'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:243:in `each'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:243:in `execute'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:180:in `invoke_with_call_chain'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:209:in `block in invoke_prerequisites'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:207:in `each'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:207:in `invoke_prerequisites'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:186:in `block in invoke_with_call_chain'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:180:in `invoke_with_call_chain'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/task.rb:173:in `invoke'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:152:in `invoke_task'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:108:in `each'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:108:in `block in top_level'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:117:in `run_with_threads'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:102:in `top_level'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/rake_proxy.rb:13:in `block in run_rake_task'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/rake_proxy.rb:10:in `run_rake_task'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:migrate => environment
Anyone got any ideas as to why this is?
added if Rails.env.production? at the top of my omniauth initialzer file
Just adding it at the top will do nothing. Wrap your logic in the conditional
if Rails.env.production?
# your omniauth stuff
end

`undefined method `default_timezone=' for ActiveRecord::Base:Class` on Ubuntu 14.04

I'm trying to set up an Ubuntu 14.04 instance to host a rails 4.2 application that I'm developing, but I keep hitting this same error, no matter how ruby/rails are installed. I'm using ruby 2.2.0, and rails 4.2.0
When I try to run any command that initialises rails, I get the following exception:
undefined method `default_timezone=' for ActiveRecord::Base:Class
This occurs when using ruby installed via the brightbox/ruby-ng apt repository, and when installed via rbenv and ruby-build. The application doesn't have this error with the same versions of ruby/rails installed on my OS X 10.10.2 machine.
Here's the full stack trace when running $ bin/rake db:migrate --trace:
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
NoMethodError: undefined method `default_timezone=' for ActiveRecord::Base:Class
/var/lib/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/dynamic_matchers.rb:26:in `method_missing'
/var/lib/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/railtie.rb:71:in `block (2 levels) in <class:Railtie>'
/var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:28:in `block in on_load'
/var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:27:in `each'
/var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/lazy_load_hooks.rb:27:in `on_load'
/var/lib/gems/2.2.0/gems/activerecord-4.2.0/lib/active_record/railtie.rb:69:in `block in <class:Railtie>'
/var/lib/gems/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `instance_exec'
/var/lib/gems/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:30:in `run'
/var/lib/gems/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
/usr/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
/usr/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
/usr/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
/usr/lib/ruby/2.2.0/tsort.rb:345:in `each'
/usr/lib/ruby/2.2.0/tsort.rb:345:in `call'
/usr/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
/usr/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
/usr/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
/var/lib/gems/2.2.0/gems/railties-4.2.0/lib/rails/initializable.rb:54:in `run_initializers'
/var/lib/gems/2.2.0/gems/railties-4.2.0/lib/rails/application.rb:352:in `initialize!'
[redacted project dir]/config/environment.rb:5:in `<top (required)>'
/var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `block in require'
/var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:240:in `load_dependency'
/var/lib/gems/2.2.0/gems/activesupport-4.2.0/lib/active_support/dependencies.rb:274:in `require'
/var/lib/gems/2.2.0/gems/railties-4.2.0/lib/rails/application.rb:328:in `require_environment!'
/var/lib/gems/2.2.0/gems/railties-4.2.0/lib/rails/application.rb:443:in `block in run_tasks_blocks'
/usr/lib/ruby/2.2.0/rake/task.rb:240:in `call'
/usr/lib/ruby/2.2.0/rake/task.rb:240:in `block in execute'
/usr/lib/ruby/2.2.0/rake/task.rb:235:in `each'
/usr/lib/ruby/2.2.0/rake/task.rb:235:in `execute'
/usr/lib/ruby/2.2.0/rake/task.rb:179:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/usr/lib/ruby/2.2.0/rake/task.rb:201:in `block in invoke_prerequisites'
/usr/lib/ruby/2.2.0/rake/task.rb:199:in `each'
/usr/lib/ruby/2.2.0/rake/task.rb:199:in `invoke_prerequisites'
/usr/lib/ruby/2.2.0/rake/task.rb:178:in `block in invoke_with_call_chain'
/usr/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/usr/lib/ruby/2.2.0/rake/task.rb:172:in `invoke_with_call_chain'
/usr/lib/ruby/2.2.0/rake/task.rb:165:in `invoke'
/usr/lib/ruby/2.2.0/rake/application.rb:150:in `invoke_task'
/usr/lib/ruby/2.2.0/rake/application.rb:106:in `block (2 levels) in top_level'
/usr/lib/ruby/2.2.0/rake/application.rb:106:in `each'
/usr/lib/ruby/2.2.0/rake/application.rb:106:in `block in top_level'
/usr/lib/ruby/2.2.0/rake/application.rb:115:in `run_with_threads'
/usr/lib/ruby/2.2.0/rake/application.rb:100:in `top_level'
/usr/lib/ruby/2.2.0/rake/application.rb:78:in `block in run'
/usr/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/usr/lib/ruby/2.2.0/rake/application.rb:75:in `run'
bin/rake:4:in `<main>'
Tasks: TOP => db:migrate => environment
I've tried setting config.time_zone and config.active_record.default_timezone in my config/application.rb file, but neither helped.
Does anyone have any suggestions to fix this?

Rake tasks keep failing

I'm trying to set up my development environment to work with an existing project that's using Mongoid. I've run bundle install and that worked fine, but I'm now trying to set up the database, and I'm running rake db:setup
Here's the output:
[1] $ rake db:setup --trace ✘
** Invoke db:setup (first_time)
** Invoke db:create (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.+
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/bundler/gems/cantango-36e3ce152717/lib/cantango/configuration/registry.rb:31:in `register'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/bundler/gems/cantango-36e3ce152717/lib/cantango/configuration/candidate_registry.rb:10:in `register'
/home/chintanparikh/Documents/Work/project_name/config/initializers/cantango.rb:8:in `block in <top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/bundler/gems/cantango-36e3ce152717/lib/cantango.rb:23:in `configure'
/home/chintanparikh/Documents/Work/project_name/config/initializers/cantango.rb:2:in `<top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `block in load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:234:in `load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/engine.rb:556:in `block (2 levels) in <class:Engine>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/engine.rb:555:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/engine.rb:555:in `block in <class:Engine>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/chintanparikh/Documents/Work/project_name/config/environment.rb:5:in `<top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0/gems/railties-3.1.3/lib/rails/application.rb:193:in `block (2 levels) in initialize_tasks'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:227:in `call'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:227:in `block in execute'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:222:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:222:in `execute'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:166:in `block in invoke_with_call_chain'
/home/chintanparikh/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:187:in `block in invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
/home/chintanparikh/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:187:in `block in invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:185:in `invoke_prerequisites'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:165:in `block in invoke_with_call_chain'
/home/chintanparikh/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:159:in `invoke_with_call_chain'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/task.rb:152:in `invoke'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:141:in `invoke_task'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:99:in `block (2 levels) in top_level'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:99:in `each'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:99:in `block in top_level'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:108:in `run_with_threads'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:93:in `top_level'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:71:in `block in run'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:158:in `standard_exception_handling'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/lib/rake/application.rb:68:in `run'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/gems/rake-10.0.1/bin/rake:37:in `<top (required)>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/rake:19:in `load'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/rake:19:in `<main>'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/ruby_noexec_wrapper:14:in `eval'
/home/chintanparikh/.rvm/gems/ruby-1.9.3-p0#global/bin/ruby_noexec_wrapper:14:in `<main>'
Tasks: TOP => db:setup => db:create => environment
Does anyone know how to fix this? It looks like it's failing on the create step.
Cheers.
MongoDB is a schema-less database. You don't need to use any of the rake db:{} functions with it. The only thing you need to do to have mongodb up and running is to install it and then to start the server. You can find more information on installing MongoDB here

rake db:migrate YAML parser error

I use ruby 1.9.2 and rake 0.9.2.2 on Ubuntu.
When I want to
rake db:migrate
I get the following error message
rake aborted!
couldn't parse YAML at line 89 column 16
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/psych.rb:148:in `parse'
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/psych.rb:148:in `parse_stream'
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/psych.rb:119:in `parse'
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/psych.rb:106:in `load'
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/psych.rb:205:in `load_file'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/i18n-0.6.0/lib/i18n/backend/base.rb:171:in `load_yml'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/i18n-0.6.0/lib/i18n/backend/base.rb:157:in `load_file'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/i18n-0.6.0/lib/i18n/backend/base.rb:15:in `block in load_translations'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/i18n-0.6.0/lib/i18n/backend/base.rb:15:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/i18n-0.6.0/lib/i18n/backend/base.rb:15:in `load_translations'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/i18n-0.6.0/lib/i18n/backend/simple.rb:57:in `init_translations'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/i18n-0.6.0/lib/i18n/backend/simple.rb:71:in `lookup'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/i18n-0.6.0/lib/i18n/backend/base.rb:26:in `translate'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/i18n-0.6.0/lib/i18n.rb:156:in `block in translate'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/i18n-0.6.0/lib/i18n.rb:152:in `catch'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/i18n-0.6.0/lib/i18n.rb:152:in `translate'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activerecord-3.1.3/lib/active_record/railtie.rb:102:in `block in <class:Railtie>'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:34:in `call'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:42:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.1.3/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/application/finisher.rb:56:in `block in <module:Finisher>'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
/home/ralv/devapp/config/environment.rb:5:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/application.rb:83:in `require_environment!'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/railties-3.1.3/lib/rails/application.rb:193:in `block (2 levels) in initialize_tasks'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `call'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:205:in `block in execute'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:200:in `execute'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:176:in `block in invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:174:in `invoke_prerequisites'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:151:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/task.rb:144:in `invoke'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:116:in `invoke_task'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `each'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:94:in `block in top_level'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:88:in `top_level'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:66:in `block in run'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/rvm/gems/ruby-1.9.2-p318/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/usr/local/rvm/gems/ruby-1.9.2-p318/bin/rake:19:in `load'
/usr/local/rvm/gems/ruby-1.9.2-p318/bin/rake:19:in `<main>'
Tasks: TOP => db:migrate => environment
I can solve the problem by commenting out the 89th line of my locale file:
open_tasks: %{total} (%{count} offen)
But it's quite annoying to do this everytime I want to migrate the database...
The problem seems to be the blank character in front of the first percent sign. If I change the line to
open_tasks: (%{total} (%{count} offen)
I can migrate without an abortion.
How can I avoid this parser error?
Thanks
Christian
You can use quotes for complex values
open_tasks: "%{total} (%{count} offen)"

Resources