我们正在构建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 <"…}
我们需要在layout.html.erb中使用脚本标记来说明以下内容:
<script type="application/javascript" src="/public/assets/arbor.js"></script>
我在Heroku上运行时遇到了大量问题,而且我找不到足够的文档。任何想法?
答案 0 :(得分:1)
如果您尝试直接在浏览器中加载http://www.thoughtly.io/public/assets/arbor.js
,则会将您重定向到http://www.thoughtly.io/
。这意味着script
标记正在尝试解析HTML页面,就好像它是一个Javascript文件(导致Unexpected token <
错误。检查控制器中是否有任何before_filter
导致重定向