Rails Webpacker compile error on Production enviorment
I have the same issue when I run pre-built rails 6 app.Found out it is because of Webpack version inconsistency in yarn.lock file. Then when I run
yarn add @rails/webpacker
bundle update webpacker
as found in this comment , issue's solved.
Remove Webpacker:
rm -rf bin/webpack*
Install Webpacker:
rails webpacker:install
Compile by Webpacker in production
mode:
RAILS_ENV=production rails webpacker:compile
I'd the same problem. Just run in development environment:
rails webpacker:install
If you use Docker, run:
docker exec rails-app-name rails webpacker:install