(AWS) ArgumentError: Missing `secret_key_base` for 'production' environment, set this string with `rails credentials:edit`

bundle exec rails assets:precompile RAILS_ENV=production

本番環境でコードをコンパイルしたい場合

ArgumentError: Missing `secret_key_base` for 'production' environment, set this string with `rails credentials:edit`

の表記がでた場合

$ ls
application.rb  cable.yml            database.yml    environments  leaflet.rb  puma.rb    spring.rb
boot.rb         credentials.yml.enc  environment.rb  initializers  locales     routes.rb  storage.yml
 credentials.yml.enc  

を消す必要がある。これは  credentials.yml.enc が本番環境のキーとあってない為のエラー。

アプリ名(config)$ rm credentials.yml.enc 

で  credentials.yml.enc  を消し

$ EDITOR=vim rails credentials:edit

再生成する。