[英]Heroku & Rails 3.2 We're sorry but something went wrong
I'm having a really bad day at this: #rails-noob #githubsucks #herokufail #abouttosmashmylaptop. 我今天过得很糟糕:#rails-noob #githubsucks #herokufail #abouttosmashmylaptop。 Ok, I feel better.
好吧,我感觉好些了。
I have created an app using Rails 3.2.12/ruby 1.9.3. 我已经使用Rails 3.2.12 / ruby 1.9.3创建了一个应用程序。 It's working locally - no issues at all - and I've saved locally with github, although I'm having some github.com issues (see this question Git duplication - receive pack not found ).
它在本地运行-完全没有问题-尽管我遇到了一些github.com问题,但我已经在github上进行了本地保存(请参阅此问题Git复制-找不到接收包 )。 So I tried to deploy to Heroku locally, ie not via github.com.
所以我尝试在本地部署到Heroku,即不通过github.com。 It seems to work - there are no obvious issues, but then when I try to actually open the application (ie browse the website) I get the infamous "We're sorry, but something went wrong".
似乎可行-没有明显的问题,但是当我尝试实际打开应用程序(即浏览网站)时,我得到了臭名昭著的“很抱歉,但是出了点问题”。 Here's what I've tried so far:
到目前为止,这是我尝试过的方法:
I've checked Heroku logs etc. multiple times, and there's no issues – everything looks fine - except that there's a 500-error. 我已经多次检查了Heroku日志等,并且没有问题-一切看起来都很好-除非有500错误。 From what I've read it seems there might have previously (pre-Rails 4.0) been a Heroku issue driving these errors, but I can't seem to find reference to either a.
从我阅读的内容来看,似乎以前(Rails 4.0之前)是导致这些错误的Heroku问题,但我似乎都找不到对这两个问题的引用。 it being fixed, or b.
它是固定的,或者b。 how to fix it.
如何解决。
Suggestions? 建议?
UPDATE: As per culix's suggestion, I tried to turn on the log level although but it doesn't seem to change the log output (time codes removed). 更新:根据culix的建议,尽管尝试了打开日志级别,但它似乎并没有改变日志输出(删除了时间代码)。
app[web.1]: Started GET "/" for 124.148.153.24 at 2013-08-11 07:30:40 +0000
app [web.1]:在2013-08-11 07:30:40 +0000上针对124.148.153.24开始获取“ /”
app[web.1]: Processing by StaticPagesController#splash as HTML
app [web.1]:由StaticPagesController#splash处理为HTML
app[web.1]: Rendered static_pages/splash.html.erb within layouts/application (2.6ms)
app [web.1]:在布局/应用程序中呈现的static_pages / splash.html.erb(2.6ms)
heroku[router]: at=info method=GET path=/ host=genericappname.herokuapp.com fwd="124.148.153.24" dyno=web.1 connect=2ms service=1470ms status=500 bytes=643
heroku [路由器]:at =信息方法=获取路径= /主机= genericappname.herokuapp.com fwd =“ 124.148.153.24” dyno = web.1 connect = 2ms服务= 1470ms状态= 500字节= 643
app[web.1]: Completed 500 Internal Server Error in 1459ms app[web.1]: ActionView::Template::Error (undefined method `[]' for nil:NilClass
app [web.1]:在1459毫秒内完成了500个内部服务器错误app [web.1]:ActionView :: Template :: Error(未定义的方法[[]]为nil:NilClass
app[web.1]: (in /app/app/assets/stylesheets/application.css)):
app [web.1] :(在/app/app/assets/stylesheets/application.css中):
app[web.1]: 2:
app [web.1]:2:
app[web.1]: 3:
应用[web.1]:3:
app[web.1]: 4: <%= full_title(yield(:title)) %>
app [web.1]:4:<%= full_title(yield(:title))%>
app[web.1]: 5: <%= stylesheet_link_tag "application", :media => "all" %>
app [web.1]:5:<%= stylesheet_link_tag“ application”,:media =>“ all”%>
app[web.1]: 6: <%= javascript_include_tag "application" %>
app [web.1]:6:<%= javascript_include_tag“应用程序”%>
app[web.1]: 7: <%= csrf_meta_tags %>
app [web.1]:7:<%= csrf_meta_tags%>
app[web.1]: 8: <%= render 'layouts/shim' %>
app [web.1]:8:<%=渲染“布局/填充”%>
app[web.1]: app/v
app [web.1]:app / v
However, when I was pushing changes back to Heroku I did pick up two issues: 但是,当我将更改推回Heroku时,确实遇到了两个问题:
Related, or an entirely new problem? 相关,还是一个全新的问题?
UPDATE 2: In response to some comments/questions: 更新2:针对一些评论/问题:
I'm struggling with lack of Heroku error info to guide me, so directions in that regard welcome also. 我一直在缺乏Heroku错误信息来指导我,因此也欢迎您提供这方面的指导。
UPDATE 3: After running 'run rake assets:precompile' I got a whole heap of Deprecation warnings, along the lines of: 更新3:运行“运行rake asset:precompile”后,我得到了一大堆弃用警告,内容如下:
You have Rails 2.3-style plugins in vendor/plugins!
您在供应商/插件中有Rails 2.3样式的插件! Support for these plugins will be removed in Rails 4.0.
这些插件的支持将在Rails 4.0中删除。 Move them out and bundle them into your gemfile.
将它们移出并将它们捆绑到您的gemfile中。
But my vendor/plugins folder is empty? 但是我的供应商/插件文件夹是空的吗?
I have also run 'rake assets:precompile --trace' (I learnt a new command!) and got the following around where the error occurs: 我还运行了“ rake asset:precompile --trace”(我学到了一条新命令!),并在发生错误的地方获得了以下信息:
** Execute assets:precompile:primary
**执行资产:预编译:主要
rake aborted!
耙子流产了!
/app/app/assets/stylesheets/application.css has already been required
/app/app/assets/stylesheets/application.css已经是必需的
/app/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:267:in `circular_call_protection'
/app/vendor/bundle/ruby/1.9.1/gems/sprockets-2.2.2/lib/sprockets/base.rb:267:in`circular_call_protection'
Ok, answering my own question in case someone else has a similar problem. 好吧,如果有人遇到类似问题,请回答我自己的问题。 Ultimately I had several issues related to the asset pipeline.
最终,我遇到了与资产管道有关的几个问题。 Somewhere along the line in application.rb file I'd put in some wild card operators (*) in the line
config.assets.precompile += %w( various file extensions)
, as per the answer to this question ( bootstrap-sass: Undefined variable: "$baseLineHeight" ). 根据这个问题的答案( bootstrap-sass
config.assets.precompile += %w( various file extensions)
,在application.rb文件中的某个位置,我在config.assets.precompile += %w( various file extensions)
行中放入了一些通配符(*)。 :未定义的变量:“ $ baseLineHeight” )。 Once I removed these, I precompiled the assets again in development ( $ RAILS_ENV=development rake assets:precompile
), and then pushed to git, then to heroku. 删除它们后,我会再次在开发中对资产进行预编译(
$ RAILS_ENV=development rake assets:precompile
),然后将其推送到git,然后推送到heroku。
Along the way I also had some issues with heaps of warnings/errors from Webrick - I solved this by specifying the Webrick version in my gemfile: 一路上,我还遇到了来自Webrick的大量警告/错误的问题-我通过在gemfile中指定Webrick版本来解决此问题:
group :development do
gem 'webrick', '~> 1.3.1'
end
If you're new to assets and deployment like me it's definitely worth reading both the RoR ( http://guides.rubyonrails.org/asset_pipeline.html ) and Heroku ( https://devcenter.heroku.com/articles/rails-asset-pipeline ) guides to the asset pipeline, as well as watching Ryan Bate's screencasts #278 and #341. 如果您像我一样不熟悉资产和部署,那么绝对值得阅读RoR( http://guides.rubyonrails.org/asset_pipeline.html )和Heroku( https://devcenter.heroku.com/articles/rails-资产管道指南),以及观看Ryan Bate的#278和#341截屏视频。
Why do you think that error in assets? 您为什么认为资产错误?
You have ActionView::Template::Error, try to debug it, where you call an array on nil object or smthg else. 您有ActionView :: Template :: Error,请尝试对其进行调试,在其中对nil对象或smthg其他对象调用数组。
PS did you pass your migrations? PS,您通过迁移了吗?
heroku run rake db:migrate
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.