我刚刚使用 Ruby on Rails 设置了 MySQL。我创建了一个新的 rails 项目,提供以下命令
rails new test1 –d mysql
该项目已成功创建,但是当我给出以下命令时出现错误
rake db:create
错误是
C:\Users\HP\test1>rake db:create
rake aborted!
(<unknown>): did not find expected key while parsing a block mapping at line 11
column 1
Tasks: TOP => db:create => db:load_config
(See full trace by running task with --trace)
运行跟踪命令时收到以下消息
C:\Users\HP\test1>rake db:create --trace
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
rake aborted!
(<unknown>): did not find expected key while parsing a block mapping at line 11
column 1
C:/Ruby200/lib/ruby/2.0.0/psych.rb:205:in `parse'
C:/Ruby200/lib/ruby/2.0.0/psych.rb:205:in `parse_stream'
C:/Ruby200/lib/ruby/2.0.0/psych.rb:153:in `parse'
C:/Ruby200/lib/ruby/2.0.0/psych.rb:129:in `load'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/railties-3.1.1/lib/rails/application/configu
ration.rb:106:in `database_configuration'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/activerecord-3.1.1/lib/active_record/railtie
s/databases.rake:6:in `block (2 levels) in <top (required)>'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:236:in `block i
n execute'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `each'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:231:in `execute
'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:175:in `block i
n invoke_with_call_chain'
C:/Ruby200/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_
with_call_chain'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:197:in `block i
n invoke_prerequisites'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `each'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:195:in `invoke_
prerequisites'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:174:in `block i
n invoke_with_call_chain'
C:/Ruby200/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:168:in `invoke_
with_call_chain'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/task.rb:161:in `invoke'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:149:in `
invoke_task'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `
block (2 levels) in top_level'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `
each'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:106:in `
block in top_level'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:115:in `
run_with_threads'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:100:in `
top_level'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:78:in `b
lock in run'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `
standard_exception_handling'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in `r
un'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rake-10.1.0/bin/rake:33:in `<top (required)>
'
C:/Ruby200/bin/rake:23:in `load'
C:/Ruby200/bin/rake:23:in `<main>'
Tasks: TOP => db:create => db:load_config
不确定要查找哪个文件的错误:
(<unknown>): did not find expected key while parsing a block mapping at line 11
column 1
我在过去的几个小时里一直在努力解决这个问题,但找不到解决方案。请指教。谢谢。