简体   繁体   English

Rails 5资产无法在生产中持续加载

[英]Rails 5 assets not loading consistently in Production

I have a = javascript_include_tag "subfolder/Js_File" at the end of the page in a view (HAML). 我在视图(HAML)的页面末尾有一个= javascript_include_tag "subfolder/Js_File"

I have the following line in manifest application.js //= link_directory ./subfolder 我在清单application.js中有以下一行//= link_directory ./subfolder

When I clear the browser cache and load the application for the first time. 当我清除浏览器缓存并首次加载应用程序时。 My assets are not loading (No CSS and JS). 我的资产未加载(没有CSS和JS)。 When I do a CTRL+R or Command+R. 当我执行CTRL + R或Command + R时。 The page loads with CSS and JS. 该页面使用CSS和JS加载。

But still the JS in "subfolder/Js_File" is not loaded. 但是仍未加载“ subfolder / Js_File”中的JS。 When I navigate out from this page and later navigate back to the page my "subfolder/Js_File" file loads and works as expected. 当我从该页面导航出来,然后又导航回到该页面时,“ subfolder / Js_File”文件将加载并按预期工作。

My production.rb has the following lines for assets 我的production.rb具有以下资产行

  config.public_file_server.enabled = true # tried changing this to false
  config.assets.compile = true # tried changing this to false
  config.assets.digest = true
  config.assets.version = '1.0'

The above configuration is correct. 上面的配置是正确的。 There was a problem with the remotely hosted asset server, it is load balanced. 远程托管的资产服务器存在问题,它是负载平衡的。 On one of the node the assets were not getting copied. 在一个节点上,资产没有被复制。 Infrastructure had to be fixed. 基础设施必须固定。

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

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