I have a ROR app where I have installed toaster and jQuery using yarn: yarn add jquery ; yarn add toastr
. Also add their configuration to application.js:
// app/assets/application.js
//= require jquery
//= require rails-ujs
//= require activestorage
//= require turbolinks
//= require toastr/toastr
Also update application.scss:
app/assets/stylesheets/application.scss
@import "toastr/toastr";
App tested locally and work good. But when I try to push it to Heroku I got this error:
remote: Running: rake assets:precompile
remote: Yarn executable was not detected in the system.
remote: Download Yarn at https://yarnpkg.com/en/docs/install
remote: I, [2020-12-01T12:43:31.158434 #1643] INFO -- : Writing /tmp/build_7363272e/public/assets/application-2b2ad3277391444ddcebbd59536eb9b2f05b9a3ad61300e3ed828b7533f992fb.js
remote: I, [2020-12-01T12:43:31.159231 #1643] INFO -- : Writing /tmp/build_7363272e/public/assets/application-2b2ad3277391444ddcebbd59536eb9b2f05b9a3ad61300e3ed828b7533f992fb.js.gz
remote: rake aborted!
remote: SassC::SyntaxError: Error: File to import not found or unreadable: toastr/toastr.
remote: on line 2:1 of app/assets/stylesheets/application.scss
remote: >> @import "toastr/toastr";
...
remote: !
remote: ! Precompiling assets failed.
remote: !
What do I need to do for fix that ?
The best way is to use elements.heroku.com/buildpacks/yarnpkg/yarn
this yarn build pack in Heroku and precompile all asset before pushing to Heroku and if that not work for you please continue to use this gem github.com/tylergannon/toastr-rails