我是ruby on rails的新手,我正在尝试开发一些演示应用程序。我想使用postgres作为数据库服务器。我正在尝试使用rake db:setup
命令从rails设置数据库。我得到以下异常。我研究使用谷歌,但我无法用我的小知识弄清楚问题。你可以帮我解决这个问题。
Ruby版本2.2.2和rails版本4.2.1
以下是例外:
$ bin/rake db:setup
/home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:303:in `block in visit_Psych_Nodes_Alias': Cannot load `Rails.application.database_configuration`:
Unknown alias: default (Psych::BadAlias)
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:303:in `fetch'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:303:in `visit_Psych_Nodes_Alias'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/visitor.rb:15:in `visit'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/visitor.rb:5:in `accept'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:31:in `accept'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:321:in `block in revive_hash'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `each'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `each_slice'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `revive_hash'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:161:in `visit_Psych_Nodes_Mapping'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/visitor.rb:15:in `visit'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/visitor.rb:5:in `accept'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:31:in `accept'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:321:in `block in revive_hash'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `each'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `each_slice'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:319:in `revive_hash'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:161:in `visit_Psych_Nodes_Mapping'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/visitor.rb:15:in `visit'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/visitor.rb:5:in `accept'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:31:in `accept'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:295:in `visit_Psych_Nodes_Document'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/visitor.rb:15:in `visit'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/visitor.rb:5:in `accept'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/visitors/to_ruby.rb:31:in `accept'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych/nodes/node.rb:37:in `to_ruby'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/psych.rb:246:in `load'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/railties-4.2.1/lib/rails/application/configuration.rb:104:in `database_configuration'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/railtie.rb:117:in `block (2 levels) in <class:Railtie>'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:44:in `each'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/base.rb:316:in `<module:ActiveRecord>'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/activerecord-4.2.1/lib/active_record/base.rb:26:in `<top (required)>'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:319:in `active_record_configured?'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:251:in `disconnect_database'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:97:in `preload'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:143:in `serve'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:131:in `block in run'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:125:in `loop'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application.rb:125:in `run'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/spring-1.3.6/lib/spring/application/boot.rb:18:in `<top (required)>'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /home/satish/.rbenv/versions/2.2.2/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from -e:1:in `<main>'