Webエンジニア目指して#51

どうもワクチンマンです。1回目は筋肉注射による筋肉痛だけでした。2回目はどうなるかな

さてrailsであれこれしているうちのエラー備忘録です。

rails error_I18n::InvalidLocaleData

ymlファイルのインデントが間違っていた。下の例が動作する記述例

attributes以降がインデント一つ分余分だったときにエラーが出た
あとはキーの定義で間に半角スペースを挟んでおらず反映されなかった

ja:
  activerecord:
    models:
      schedule: スケジュール
    attributes:
      schedule:
        title: タイトル
        start: 開始日
        end: 終了日
        allday: 終日
        memo: メモ
        created_at: 作成日時
        updated_at: 更新日時

herokuのデプロイエラー

作ったアプリをgithubとherokuなるものを使って公開する際に、デプロイを実行したら以下のエラーが出た

Your bundle only supports platforms ["x86_64-darwin-18"] but your local platform
       is x86_64-linux. Add the current platform to the lockfile with `bundle lock
       --add-platform x86_64-linux` and try again.
       Bundler Output: Your bundle only supports platforms ["x86_64-darwin-18"] but your local platform
       is x86_64-linux. Add the current platform to the lockfile with `bundle lock
       --add-platform x86_64-linux` and try again.
 !
 !     Failed to install gems via Bundler.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

なにやらlockfileのplatformがどうとか書いてあるのでgemfile.lockを覗いてみると、それっぽいのを発見
f:id:misokatsu_sand:20211012160734p:plain

エラー文の中にbundle lock --add-platform x86_64-linux実行してね、みたいなのがあるので実行するとlockファイルにx86_64-linuxが追加された(わざわざコマンド打つってことは直書きだとまずい?)

これでOK!

以上、ではでは。