railsアプリをherokuにデプロイする際にハマったポイント
前提
- railsアプリはほとんどscaffoldingで作成したまま(view、seeds.rbを少し編集した程度)
- railsバージョン:6.1.4.1
- herokuは無料アカウント
- 主にherokuのガイドを参考に実施
ハマりポイント
- herokuにpushした際にエラーが発生
remote: Your bundle only supports platforms ["arm64-darwin-20"] but your local platform remote: is x86_64-linux. Add the current platform to the lockfile with `bundle lock remote: --add-platform x86_64-linux` and try again. remote: Bundler Output: Your bundle only supports platforms ["arm64-darwin-20"] but your local platform remote: is x86_64-linux. Add the current platform to the lockfile with `bundle lock remote: --add-platform x86_64-linux` and try again.
⇨実行ログ中に表示されていた上記のメッセージに従い、bundle lock --add-platform x86_64-linux
を実行後、再度pushすると成功。
- デプロイ後アプリにアクセスできない&seeds.rbのデータが反映されていない ⇨以下コマンドを実行して解消。
heroku run rails db:migrate heroku run rails db:seed