前提・実現したいこと
Mysqlを使用したrailsアプリをherokuへデプロイしたいです。
heroku run rails db:migrate時に
下記エラーが発生しております。
解決方法ご存知のかたご教授願います。
発生している問題・エラーメッセージ
rails 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 ',' or ']' while parsing a flow sequence at line 26 column 12 Caused by: Psych::SyntaxError: (<unknown>): did not find expected ',' or ']' while parsing a flow sequence at line 26 column 12
該当のソースコード database.yml
development: <<: *default database: development_db username: <%= ENV["DATEBASE_USER_NAME"]%> password: <%= ENV["DATEBASE_USER_PASS"]%> host: localhost #host: db test: <<: *default database: test_db username: root password: root #username: <%= ENV["DATEBASE_USER_NAME"]%> #password: <%= ENV["DATEBASE_USER_PASS"]%> host: 127.0.0.1 production: <<: *default database: <%= ENV["DB_NAME"] %> username: <%= ENV["DB_USERNAME"] %> password: <%= ENV["DB_PASSWORD"] %>
参考にしたサイト
RailsDBをMySQLに変更してHerokuでデプロイまでする手順を元に
下記の内容にしたがって環境変数設定しました
$ heroku config | grep CLEARDB_DATABASE_URL mysql://aaaaa:bbbbb@ccccc.cleardb.net/heroku_ddd?reconnect=true
aaaaa = username
bbbbb = password
ccccc = hostname
heroku_ddd?reconnect = db_name
$ heroku config:add DB_NAME="[db_name]" $ heroku config:add DB_USERNAME="[username]" $ heroku config:add DB_PASSWORD="[password]" $ heroku config:add DB_HOSTNAME="[hostname]" $ heroku config:add DB_PORT="3306"
試したこと
Please note that YAML must be consistently indented using spaces.にかんしては
タブを全てスペースに変換しました。
Psych::SyntaxError: (<unknown>): did not find expected ',' or ']' while parsing a flow sequence at line 26 column 12にかんしては
参考サイトの
This error is often misleading and points the wrong line out
Look for extra spaces in the entire YML file and try to replace all enclosing single quotes by "", it should work !
を参考にして、’’を””に変更しました。(解釈まちがっているかもしれませんが、、、)
対処方法ご存知のかたなにとぞよろしくお願い足します。
補足情報(FW/ツールのバージョンなど)
ruby 2.5.0
rails 5.2
heroku heroku/7.27.1 darwin-x64 node-v11.14.0
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。