简体   繁体   English

在Ruby on Rails应用的生产部署中缺少Javascript资产,在WEBrick下一切正常

[英]Missing Javascript assets on production deployment of Ruby on Rails app, all is fine under WEBrick

Missing Javascript assets on production deployment of Ruby on Rails app, all is fine under WEBrick. 在Ruby on Rails应用程序的生产部署中缺少Javascript资产,在WEBrick下一切正常。

I have this standard Rails app I'm trying to deploy. 我有要部署的标准Rails应用程序。

The app loads fine but all Javascript has gone missing. 该应用程序加载正常,但所有Javascript都丢失了。 If I load the exact same app with WEBrick all is fine when connecting to that on port 3000. 如果我使用WEBrick加载完全相同的应用程序,则在连接端口3000上的应用程序时一切正常。

Refresh the apache app, no Javascript, refresh the WEBrick instance Javascript ok. 刷新apache应用程序(无Javascript),然后刷新WEBrick实例Javascript。

Any thoughts? 有什么想法吗?

Depending on how you are deploying the application, typically you will need to pre-compile the assets in production environment. 根据您部署应用程序的方式,通常将需要在生产环境中预编译资产。

More info here: http://guides.rubyonrails.org/asset_pipeline.html 此处提供更多信息: http : //guides.rubyonrails.org/asset_pipeline.html

Ok. 好。 Apparently this is a non-standard Rails app. 显然,这是一个非标准的Rails应用。 It seems it's looking for some assets in /var/www/mywebsite/public which aren't there. 似乎正在/ var / www / mywebsite / public中寻找一些不存在的资产。

Had a chat with the developer and you have to do a symlink from the gem install directory to you apache website. 与开发人员聊天,您必须从gem install目录到您的Apache网站进行符号链接。

ln -s /home/myuser/.rvm/gems/yourrubyversion/gems/yourgemandversion/public ln -s /home/myuser/.rvm/gems/yourrubyversion/gems/yourgemandversion/public

It works. 有用。

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

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