We've moved discussions to Discord

Webpacker can't find application.js in /app/public/packs/manifest.json

The deployment seems to be working, however, when I try to visit the URL where the app is deployed I get 500 errors and when I check the logs It shows the stack trace shown below. 

500 Internal Server Error
If you are the administrator of this website, then please read this web application's log file and/or the web server's log file to find out what went wrong.

I tried a few things here: https://github.com/rails/webpacker/issues/2071  

one suggestion was deleting but that breaks all styles
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbo-track': 'reload' %>

I added the following to the production section of the webpacker.yml
extract_css: true 
but that didn't seem to fix the issue either. 

also per the suggestion in the stack trace, I set the following in the webpacker.yml
  compile: true


The error that I'm seeing in the DigitalOcean logs

Stack Trace
Error during failsafe response: Webpacker can't find application.js in /app/public/packs/manifest.json. Possible causes:
yakinspace | 2021-04-28 06:00:11 1. You want to set webpacker.yml value of compile to true for your environment
yakinspace | 2021-04-28 06:00:11    unless you are using the `webpack -w` or the webpack-dev-server.
yakinspace | 2021-04-28 06:00:11 2. webpack has not yet re-run to reflect updates.
yakinspace | 2021-04-28 06:00:11 3. You have misconfigured Webpacker's config/webpacker.yml file.
yakinspace | 2021-04-28 06:00:11 4. Your webpack configuration is not creating a manifest.
yakinspace | 2021-04-28 06:00:11 Your manifest contains:
yakinspace | 2021-04-28 06:00:11 {}
yakinspace | 2021-04-28 06:00:11 
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/webpacker-6.0.0.beta.6/lib/webpacker/manifest.rb:79:in `handle_missing_entry'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/webpacker-6.0.0.beta.6/lib/webpacker/manifest.rb:32:in `lookup_pack_with_chunks!'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/webpacker-6.0.0.beta.6/lib/webpacker/helper.rb:146:in `block in sources_from_manifest_entrypoints'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/webpacker-6.0.0.beta.6/lib/webpacker/helper.rb:146:in `map'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/webpacker-6.0.0.beta.6/lib/webpacker/helper.rb:146:in `sources_from_manifest_entrypoints'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/webpacker-6.0.0.beta.6/lib/webpacker/helper.rb:99:in `javascript_pack_tag'
yakinspace | 2021-04-28 06:00:11   /app/app/views/layouts/errors.html.erb:16:in `_app_views_layouts_errors_html_erb___3559577576341716937_48080'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/base.rb:247:in `public_send'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/base.rb:247:in `_run'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/template.rb:154:in `block in render'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/notifications.rb:205:in `instrument'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/template.rb:345:in `instrument_render_template'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/template.rb:152:in `render'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/renderer/template_renderer.rb:72:in `block in render_with_layout'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/notifications.rb:203:in `block in instrument'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/notifications.rb:203:in `instrument'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/renderer/template_renderer.rb:70:in `render_with_layout'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/renderer/template_renderer.rb:55:in `render_template'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/renderer/template_renderer.rb:11:in `render'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/renderer/renderer.rb:29:in `render_to_object'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/rendering.rb:117:in `block in _render_template'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/base.rb:273:in `in_rendering_context'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/rendering.rb:116:in `_render_template'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/streaming.rb:218:in `_render_template'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/rendering.rb:103:in `render_to_body'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/rendering.rb:52:in `render_to_body'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/renderers.rb:142:in `render_to_body'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/abstract_controller/rendering.rb:25:in `render'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/rendering.rb:36:in `render'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/instrumentation.rb:46:in `block (2 levels) in render'
yakinspace | 2021-04-28 06:00:11   /usr/local/lib/ruby/3.0.0/benchmark.rb:308:in `realtime'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/core_ext/benchmark.rb:14:in `ms'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/instrumentation.rb:46:in `block in render'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/instrumentation.rb:86:in `cleanup_view_runtime'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activerecord-6.1.3.1/lib/active_record/railties/controller_runtime.rb:39:in `cleanup_view_runtime'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/instrumentation.rb:45:in `render'
yakinspace | 2021-04-28 06:00:11   /app/app/controllers/errors_controller.rb:3:in `not_found'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/abstract_controller/base.rb:228:in `process_action'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/callbacks.rb:117:in `block in run_callbacks'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actiontext-6.1.3.1/lib/action_text/rendering.rb:20:in `with_renderer'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actiontext-6.1.3.1/lib/action_text/engine.rb:55:in `block (4 levels) in <class:Engine>'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/callbacks.rb:126:in `instance_exec'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/callbacks.rb:126:in `block in run_callbacks'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/callbacks.rb:137:in `run_callbacks'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/notifications.rb:203:in `block in instrument'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/notifications.rb:203:in `instrument'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/instrumentation.rb:33:in `process_action'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal/params_wrapper.rb:249:in `process_action'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activerecord-6.1.3.1/lib/active_record/railties/controller_runtime.rb:27:in `process_action'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/abstract_controller/base.rb:165:in `process'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionview-6.1.3.1/lib/action_view/rendering.rb:39:in `process'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal.rb:190:in `dispatch'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_controller/metal.rb:254:in `dispatch'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/routing/route_set.rb:33:in `serve'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/journey/router.rb:50:in `block in serve'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/journey/router.rb:32:in `each'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/journey/router.rb:32:in `serve'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/routing/route_set.rb:842:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/middleware/show_exceptions.rb:52:in `render_exception'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/middleware/show_exceptions.rb:36:in `rescue in call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/railties-6.1.3.1/lib/rails/rack/logger.rb:37:in `call_app'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/railties-6.1.3.1/lib/rails/rack/logger.rb:26:in `block in call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/tagged_logging.rb:99:in `block in tagged'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/tagged_logging.rb:37:in `tagged'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/tagged_logging.rb:99:in `tagged'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/railties-6.1.3.1/lib/rails/rack/logger.rb:26:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/request_store-1.5.0/lib/request_store/middleware.rb:19:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/middleware/request_id.rb:26:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/rack-2.2.3/lib/rack/runtime.rb:22:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/activesupport-6.1.3.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/rack-2.2.3/lib/rack/sendfile.rb:110:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/actionpack-6.1.3.1/lib/action_dispatch/middleware/host_authorization.rb:92:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/railties-6.1.3.1/lib/rails/engine.rb:539:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/puma-5.2.2/lib/puma/configuration.rb:248:in `call'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/puma-5.2.2/lib/puma/request.rb:76:in `block in handle_request'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/puma-5.2.2/lib/puma/thread_pool.rb:337:in `with_force_shutdown'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/puma-5.2.2/lib/puma/request.rb:75:in `handle_request'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/puma-5.2.2/lib/puma/server.rb:431:in `process_client'
yakinspace | 2021-04-28 06:00:11   /gems/ruby/3.0.0/gems/puma-5.2.2/lib/puma/thread_pool.rb:145:in `block in spawn_thread'

Jack Riminton
I've been having problems with Webpack in all my jumpstart apps recently too

My latest one today is:
16:33:43 webpack.1 | TypeError: The 'compilation' argument must be an instance of Compilation
16:33:43 webpack.1 |     at Function.getCompilationHooks (/Users/j/code/ror/mylinks/node_modules/@rails/webpacker/node_modules/webpack/lib/NormalModule.js:180:10)
Brian Hayden
I had this error yesterday and solved it by editing the webpacker.yml file to point to the packs/application.js file. I edited the source_path and source_entry_path values.

Here is the relevant section of the new manifest.json file:

default: &default
  source_path: app/javascript/
  source_entry_path: packs
  public_root_path: public
  public_output_path: packs
  cache_path: tmp/cache/webpacker
  webpack_compile_output: true


Seth Silvester
After a bunch of trial and error and reading the web about related problems, these steps fixed my issue.

rails tmp:clearslope game
rails webpacker:install
rails tmp:clear


And, restarting the server between each command.  

I guess something was cached that just needed to get flushed out. 

Notifications
You’re not receiving notifications from this thread.