Webpacker can't find the manifest.json file in production environment

In the production environment, running bundle exec rake assets:precompile will create If you run bundle exec rake assets:precompile in the production environment, public/packs/manifest.json will be created and
If you look at the contents with the cat command, you will see the following.

$ cat public/packs/manifest.json

{
"application.css": "/packs/css/application-b673e020.css",
"application.js": "/packs/js/application-0777f7a506acd75b1bfd.js",
"application.js.map": "/packs/js/application-0777f7a506acd75b1bfd.js.map",
"entrypoints": {
"application": {
"css": [
"/packs/css/application-b673e020.css"
],
"js": [
"/packs/js/application-0777f7a506acd75b1bfd.js"
],
"js.map": [
"/packs/js/application-0777f7a506acd75b1bfd.js.map"
]
}
}
}

In the production environment, if you look at the site, you will see the following error.

Jul 18 10:42:53 AM [301cc4fd-cc01-495c-8903-202c0f9c66ad] ActionView::Template::Error (Webpacker can't find application in /opt/render/project/src/public/packs/manifest.json. Possible causes:
Jul 18 10:42:53 AM 1. You want to set webpacker.yml value of compile to true for your environment
Jul 18 10:42:53 AM unless you are using the `webpack -w` or the webpack-dev-server.
Jul 18 10:42:53 AM 2. webpack has not yet re-run to reflect updates.
Jul 18 10:42:53 AM 3. You have misconfigured Webpacker's config/webpacker.yml file.
Jul 18 10:42:53 AM 4. Your webpack configuration is not creating a manifest.
Jul 18 10:42:53 AM Your manifest contains:
Jul 18 10:42:53 AM {
Jul 18 10:42:53 AM }
Jul 18 10:42:53 AM ):

Looking at the log, there is nothing in the contents.

Jul 18 10:42:53 AM Your manifest contains:
Jul 18 10:42:53 AM {
Jul 18 10:42:53 AM }
Jul 18 10:42:53 AM ):

I found a site with the same error and installed webpacker version 3.5, but the situation remained the same.

https://www.it-swarm-ja.com/ja/heroku/webpackerがmanifestjson-heroku-productionでapplicationjsを見つけることができません/806400635/

I’d like to know what you think. :pray:

Hi @narutedzzzz,

It looks like your webpack configuration might be incorrect, can you check all the possible reasons listed here webpack - Rails Webpacker compile error on Production enviorment - Stack Overflow