简体   繁体   English

使用NginX Server将Rails应用程序部署到VPS。 编译问题

[英]Deploying a Rails App to VPS, with NginX Server. Compile Issues

I successfully deployed my rails app to my VPS, but when I try to look at my server from browser, I get a 500 error ("We're sorry, but something's wrong"). 我已成功将Rails应用程序部署到了VPS,但是当我尝试从浏览器查看服务器时,出现500错误(“很抱歉,出现了问题”)。 The app is working fine locally, so I think the problem lies in not my code but somewhere else. 该应用程序在本地运行良好,因此我认为问题不在于我的代码,而在于其他地方。

Here's the log from /current/log/production.log 这是/current/log/production.log中的日志

ActionView::Template::Error (jquery.js isn't precompiled):
    4:   <title>Songhomme</title>
5:   <%= stylesheet_link_tag    "application", :media => "all" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= javascript_include_tag 'jquery' %>
8:   <%= csrf_meta_tags %>
9: </head>
10: <body>
  app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb___2525571063257357898_28769560'

I also got the following error: 我也收到以下错误:

ActionView::Template::Error (/home/deployer/apps/songhomme/releases/20121204091428/app/views/posts/_posts.erb:27: syntax error, unexpected ',', expecting ')'
...ppend= ( link_to (t.name + " ", '/tags/' + t.id.to_s) );@out...

The code is working fine locally, so I'm not sure what's wrong with the second part of code. 该代码在本地运行良好,所以我不确定第二部分代码有什么问题。 For the first part of code, does running rake assets:precompile before I push to my repo solve the problem? 对于代码的第一部分,在推送到rake assets:precompile之前运行rake assets:precompile是否可以解决问题?

I appreciate your help. 我感谢您的帮助。

Try declaring your js includes in the manifest file application.js , not by javascript_include_tag. 尝试声明清单文件中的js包含在application.js中,而不要通过javascript_include_tag声明。 Since Rails version 3 this is the proper way . 从Rails版本3开始,这是正确的方法。 So , in your application.js : 因此,在您的application.js中:

//= require jquery
//= require jquery_ujs

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

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