Skip to content

Instantly share code, notes, and snippets.

@alexdesi
Created December 12, 2023 08:30
Show Gist options
  • Save alexdesi/c35ca8da0d264b6a917ac62efa0aa969 to your computer and use it in GitHub Desktop.
Save alexdesi/c35ca8da0d264b6a917ac62efa0aa969 to your computer and use it in GitHub Desktop.
Debugging Ruby on Rails error: ActionView::Template::Error (Webpacker can't find media/images/...
Sometimes, this error occurs when I run a rails app on my local:
```
ActionView::Template::Error (Webpacker can't find media/images/...
1. You want to set webpacker.yml value of compile to true for your environment
unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
...
```
Try to precompile your assets:
`bundle exec rails assets:precompile`
In one of my projects, when I tried to precompile the assets, it issued the error:
```
Compiling...
Compilation failed:
.../nodejs/16.5.0/bin/node: --openssl-legacy-provider is not allowed in NODE_OPTIONS
```
The reason was that my system had an old nodejs version.
I updated nodejs to 20.8, and it fixed the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment