简体   繁体   中英

Rails app not loading Arbor.js once deployed to heroku

We're building a rails app and using Arbor.js to display a node graph on the web page of the rails app, and it works fine on localhost, but when we deploy, we get the following errors.

Resource interpreted as Script but transferred with MIME type text/html: "http://www.thoughtly.io/users/9/categories". 29:11
Refused to execute script from 'http://www.thoughtly.io/public/assets/arbor.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled. 29:1
arbor.js/web-workers 
Object {integrator: "verlet", repulsion: 1000, stiffness: 30, friction: 40, dt: 0.02…}
 VM414:1
Resource interpreted as Script but transferred with MIME type text/html: "http://www.thoughtly.io/users/9/categories". application-7588a131d5b5b403e30855abe426e8c5.js:11681
physics: 
ErrorEvent {error: null, colno: 1, lineno: 1, filename: "http://www.thoughtly.io/public/assets/arbor.js", message: "Uncaught SyntaxError: Unexpected token <"…}

We're requiring it with a script tag in layout.html.erb that says the following:

  <script type="application/javascript" src="/public/assets/arbor.js"></script>

I'm having massive problems getting it to run on Heroku and I cannot find enough documentation on it. any ideas?

If you try loading http://www.thoughtly.io/public/assets/arbor.js directly in your browser, you'll be redirected to http://www.thoughtly.io/ . This means that the script tag is trying to parse an HTML page as if it was a Javascript file (which causes the Unexpected token < error. Check if any before_filter in your controllers is causing the redirect.

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