Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Webpacker can't find application.js in manifest.json Heroku Production

Tags:

webpack

heroku

I'm having a webpacker issue with my app on heroku.

The log:

ActionView::Template::Error (Webpacker can't find application.js in /app/public/packs/manifest.json. Possible causes:
2018-07-04T18:47:08.192729+00:00 app[web.1]: 1. You want to set webpacker.yml value of compile to true for your environment
2018-07-04T18:47:08.192730+00:00 app[web.1]:    unless you are using the `webpack -w` or the webpack-dev-server.
2018-07-04T18:47:08.192733+00:00 app[web.1]: 2. webpack has not yet re-run to reflect updates.
2018-07-04T18:47:08.192734+00:00 app[web.1]: 3. You have misconfigured Webpacker's config/webpacker.yml file.
2018-07-04T18:47:08.192735+00:00 app[web.1]: 4. Your webpack configuration is not creating a manifest.
2018-07-04T18:47:08.192737+00:00 app[web.1]: Your manifest contains:
2018-07-04T18:47:08.192738+00:00 app[web.1]: {
2018-07-04T18:47:08.192740+00:00 app[web.1]: }
2018-07-04T18:47:08.192741+00:00 app[web.1]: ):

I have a manifest.json file which does contain application.js:

{
  "application.css": "/packs/application-c922057d6b9db34084d6e52c6f32baa9.css",
  "application.css.map": "/packs/application-c922057d6b9db34084d6e52c6f32baa9.css.map",
  "application.js": "/packs/application-ab33c1479403810d7775.js",
  "application.js.map": "/packs/application-ab33c1479403810d7775.js.map"
}

It's interesting the final line in the log:

2018-07-04T18:47:08.192737+00:00 app[web.1]: Your manifest contains:
2018-07-04T18:47:08.192738+00:00 app[web.1]: {
2018-07-04T18:47:08.192740+00:00 app[web.1]: }

Is the formatting in the json wrong somehow?

I've tried running bundle exec rails webpacker:compile which was fine, and I've also updated the binstub bundle exec rails webpacker:binstubs, neither seem to have made a difference after pushing to Heroku.

What else can I try?

like image 915
Simon Cooper Avatar asked Jul 04 '18 19:07

Simon Cooper


3 Answers

  • I removed folder node_modules
  • then on terminal yarn add @rails/webpacker@next
  • then bundle exec rails webpacker:install

after that, it's fixed

like image 59
Hany Moh. Avatar answered Nov 15 '22 01:11

Hany Moh.


I had the same issue and spent days trying to solve it. Finally installed webpacker 3.5 and works fine.

It is not the best solution but that gets my app up. I went on a rabbit hole trying solve this issue.

like image 39
gsumk Avatar answered Nov 15 '22 03:11

gsumk


bundle exec bin/webpack-dev-server

this command solved my issue. I'm new to webpack, so I don't know how / why.

like image 2
Oshan Wisumperuma Avatar answered Nov 15 '22 01:11

Oshan Wisumperuma