简体   繁体   中英

Heroku - ActionView::Template::Error

I adding in my rails app "audiojs" music player ( http://kolber.github.com/audiojs/ )

on localhost all good and work, but heroku says:

"We're sorry, but something went wrong."

log

ActionView::Template::Error (audiojs/audio.min.js isn't precompiled)

how to solve the problem?

The problem is in your main page javascript. You're trying to load a track, but the elements you're looking for don't exist so you're getting the undefined error.

var audio = a[0];
first = $('ol a').attr('data-src');

// Add this code to layouts/application.html.erb
// First is coming back undefined on your root route.
if (first == undefined)
  console.log("First is undefined! Will cause error in audio track");

$('ol li').first().addClass('playing');
audio.load(first);

Whereas, you're setting data-src="<%= show.preview %>" in releases/show.html.erb (and index.html.erb ) and the code works without issue there.

Your options are to detect if there are no order list items and not try to automatically play an audio track, or add audio tracks to your main page.

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