12

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?

Simon Cooper
  • 1,574
  • 4
  • 24
  • 53

6 Answers6

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

after that, it's fixed

Hany Moh.
  • 949
  • 1
  • 11
  • 11
2

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.

gsumk
  • 809
  • 10
  • 15
  • A year later your response continues to be the valid one unfortunately. I had to update from 3.5 to 4.0 for it to work, after multiple days and several failed attempts to fix this issue. Still no clue what was causing it but works now. – Esteban Bouza Jul 15 '19 at 22:24
  • what a mess, on webpack 6 now so this is obsolete. funny thing is it's happened before and I've fixed it.. then it happened again(!!). webpack(er) needs removing from the internet. – Damien Roche Mar 29 '21 at 20:17
2
bundle exec bin/webpack-dev-server

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

Oshan Wisumperuma
  • 1,808
  • 1
  • 18
  • 32
0

In case you are still stuck with this, I was having exactly the same problem and no other answers seemed to solve it for me. This GH thread advised ensuring that assets weren't precompiled locally (by removing /public/assets and /public/packs directories, essentially encouraging Heroku to compile for itself. Seems to have cleared up the issue for me for now.

https://github.com/rails/webpacker/issues/532

André Goldstein
  • 367
  • 1
  • 3
  • 9
0

I ran into the exact same error. Try this if you have not yet.

run bundle exec rails webpacker:install

check console logs for the error message

The engine "node" is incompatible with this module. Expected version ">= 10.13.0". Got "10.0.0"
error Found incompatible module.

if yes, then you can resolve this issue in 3 steps:

$ node -v checks your node version

$ nvm install 'required node version' changes the node version

$ bundle exec rails webpacker:install It will validate your package.json, resolve and fetch all the packages, link and save dependencies

Sumeet Raina
  • 117
  • 6
0

In my case below steps helped for newly added pack file that was not found by webpacker

RAILS_ENV=staging rake  assets:clean

rake assets:clobber

RAILS_ENV=production rake assets:precompile
Syed Shibli
  • 992
  • 1
  • 12
  • 15