-1

heroku ran rake db:migrateを実行すると下記のようなエラーがでます。
database.ymlに別に異常はないようですがどうすればいいのでしょうか。教えて下さい。

rake aborted!
YAML syntax error occurred while parsing /app/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (<unknown>): did not find expected key while parsing a block mapping at line 1 column 1
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/application/configuration.rb:115:in `rescue in database_configuration'
/app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.1/lib/rails/application/configuration.rb:98:in `database_configuration'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/railtie.rb:117:in `block (2 levels) in <class:Railtie>'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:44:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.1/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/base.rb:316:in `<module:ActiveRecord>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/base.rb:26:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/tasks/mysql_database_tasks.rb:8:in `<class:MySQLDatabaseTasks>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/tasks/mysql_database_tasks.rb:3:in `<module:Tasks>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/tasks/mysql_database_tasks.rb:2:in `<module:ActiveRecord>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/tasks/mysql_database_tasks.rb:1:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:50:in `<module:DatabaseTasks>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:37:in `<module:Tasks>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:4:in `<module:ActiveRecord>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/tasks/database_tasks.rb:3:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.2.1/lib/active_record/railtie.rb:41:in `block (3 levels) in <class:Railtie>'
Tasks: TOP => db:migrate => db:load_config(See full trace by running task with --trace)
3
  • database.yml に何かしらの問題があると考えるのが妥当です。まずは database.yml を共有してください。特にタブ文字などのスペーシングが変わらない方法で共有してもらえると良いでしょう。
    – KoRoN
    2015年9月25日 7:41
  • ご意見下さった方ありがとうございました。本当に助かりました。
    – komainu
    2015年9月28日 10:03
  • @komainu 正しい回答を貰えた場合は、回答の左側にあるチェックマークをチェックしましょう。そうしてStackOverflowのコミュニティは成長していきます
    – shirakia
    2015年10月28日 12:47

1 件の回答 1

2

YAML syntax error occurred while parsing /app/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed.

エラー文の2行目にこう書いてあるということは、スペースの代わりにタブが使われているということではないですか?

Tabs are not allowed.

こう言っているということはタブが使われていると思うので、タブをスペースに変換する必要があると思います。

この質問に回答するには、ログインする必要があります。

求めていた回答ではありませんか? のタグが付いた他の質問を参照する。