简体   繁体   中英

why am i getting this routing error? ActionController::RoutingError (No route matches [GET] "/assets/toastr.js.map"):

I'm seeing this on localhost and prod:

ActionController::RoutingError (No route matches [GET] "/assets/toastr.js.map"):

I've tried including toastr.js.map in my manifest file: no luck. Also tried renaming the file to toastr.map.js - which immediately started throwing js errors in the console.

Is there a way to either automatically generate map files or ignore them?

I came across a similar problem recently. The way I solved it was by going inside the manifest file (eg, public/assets/.sprockets-manifest-[md5hash].json , finding the logical names of the asset files and using those instead of the absolute paths.

In my case, the fix was to remove the /assets/ prefix from the javascript_include_tag .

In particular, in my html files I replaced this...

= javascript_include_tag "/assets/admin/events/index.js"

...with this...

= javascript_include_tag "admin/events/index.js"

...and recompiled assets. This seemed to do the trick for me.

Here's a reference to the thread where I found this solution:
Rails 5 + Heroku: Assets are not loaded in production, but works in localhost

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM