gpt4 book ai didi

javascript - Rails 应用程序部署到 heroku 后不会加载 Arbor.js

转载 作者:行者123 更新时间:2023-12-03 12:08:39 24 4
gpt4 key购买 nike

我们正在构建一个rails应用程序,并使用Arbor.js在rails应用程序的网页上显示节点图,它在本地主机上运行良好,但是当我们部署时,我们收到以下错误。

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 上运行时遇到了很大的问题,而且我找不到足够的文档。有什么想法吗?

最佳答案

如果您尝试加载http://www.thoughtly.io/public/assets/arbor.js直接在浏览器中,您将被重定向到 http://www.thoughtly.io/ 。这意味着script标签正在尝试解析 HTML 页面,就好像它是 Javascript 文件一样(这会导致 Unexpected token < 错误。检查 Controller 中是否有任何 before_filter 导致重定向。

关于javascript - Rails 应用程序部署到 heroku 后不会加载 Arbor.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25062184/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com