環境
MacOS Mojave: 10.14.6
Docker: 19.03.8
Ruby: 2.6.6
Rails: 6.0.0
PostgreSQL
問題
RailsチュートリアルのSample_appを
Docker環境に移行している途中で
docker-compose up
のあとpumaが起動した後すぐに以下のエラーを吐いて落ちる現象に遭遇
warning Integrity check: System parameters don't match
app_1 | error Integrity check failed
app_1 | error Found 1 errors.
app_1 |
app_1 |
app_1 | ========================================
app_1 | Your Yarn packages are out of date!
app_1 | Please run `yarn install --check-files` to update.
app_1 | ========================================
app_1 |
app_1 |
app_1 | To disable this check, please change `check_yarn_integrity`
app_1 | to `false` in your webpacker config file (config/webpacker.yml).
app_1 |
app_1 |
app_1 | yarn check v1.22.4
app_1 | info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
config/webpacker.ymlを編集する解決方法が見つかったがこれでは解決せず
yarnが原因でdocker-compose runが実行できないときの対処法 - Qiita
解決
こちらを参考にconfig/environments/development.rb
とconfig/webpacker.yml
を編集して解決しました
Running a Rails app with Webpacker and Docker - Dirk de Kok - Medium
Last configuration for Yarn and Webpacker
Rails does a lot of checkups on Yarn, a bit too much. Best is to disable this:
# config/environments/development.rb config.webpacker.check_yarn_integrity = false
Also, we need to tell Rails that the webpacker server is running on the host webpacker and enable hot module reload. So set these values:
# config/webpacker.yml development: dev_server: host: webpacker hmr: true
Last configuration for Yarn and Webpacker