rails: ActionController::RoutingError (No route matches [GET] "/assets/application.js....)
I’m suddenly faced with
ActionController::RoutingError (No route matches [GET] "/assets/application.js-920efc795bbe74efc45b09c59b03e18109155fbdf62b008ca8d094aed269d334.map")
in a fresh rails 7 application using tailwind and esbuild. I cannot seem to locate where this is originating from. What might be causing this?
Removing
<%= javascript_include_tag "application", "data-turbo-track": "reload", defer: true %>
from the application.htlm.erb file removes the issue.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 17 (2 by maintainers)
For me, I solved it by doing the following:
Followed the advice of @fhcadmin above and removed everything from my assets build directory:
rm -rf app/assets/builds/*
Removed this line from
config/environments/development.rb
:config.assets.prefix = "/dev-assets"
Restarted by server with
bin/dev
and reloaded the page, the error was gone.Hope that helps someone.
What worked for me?
rake assets:clobber
And then regenerate the source map.
Remove any css file
import
within your javascripts files and instead them in yourapplication.scss
(or whatever you call it)For anybody googling this, manually clearing out the build artifacts fixes this
rm -rf app/assets/builds/*
@SkipKayhil