简体   繁体   English

一旦部署到heroku,Rails应用程序不会加载Arbor.js

[英]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. 我们正在构建一个Rails应用程序,并使用Arbor.js在Rails应用程序的网页上显示一个节点图,并且在localhost上运行良好,但是在部署时会出现以下错误。

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: 我们需要在layout.html.erb中带有脚本标签的脚本要求其内容如下:

  <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. 我在使其在Heroku上运行时遇到了很多问题,我找不到足够的文档。 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/ . 如果您尝试直接在浏览器中加载http://www.thoughtly.io/public/assets/arbor.js ,您将被重定向到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. 这意味着script标记正试图像解析Javascript文件一样解析HTML页面(这会导致Unexpected token <错误。请检查控制器中是否有before_filter引起了重定向。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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