问题
I have upgraded from rails 4 to 5. Great. Added Foundation 6 topbar, pushed to heroku. Nothing failed but website not loading. heroku run logs showed this:
<div class="title-bar" data-responsive-toggle="example-menu" data-hide-for="medium">
<button class="menu-icon" type="button" data-toggle></button>
<div class="title-bar-title">
<%= image_tag("o-section/mascot.svg") %>
</div>
</div>
The error was:
ActionView::Template::Error (Unexpected token punc «(», expected punc «:» (line: 23041, col: 10, pos: 685332) error
Is there an issue here?
回答1:
Let me close this. I can't explain why this works or used to work before adding a new image but...it works.
Looking back at the error, it was relating to a javascript function. I do not know what or where is line: 23041 but I guess that is from a compiled file. So for a long story short, all my js functions looked something like this:
foo() {
...
}
I then wondered, what if I changed all to a "vanilla js function".:
foo: function() {
...
}
So basically the clue was expected punc «:» in which it wanted foo: function(){...}
After that, I rake asset:precompile and all was well.
回答2:
Your error says it does not expect a ( and expects a : instead.
Try replacing:
<%= image_tag("o-section/mascot.svg") %>
with:
<%= image_tag: "o-section/mascot.svg" %>
来源:https://stackoverflow.com/questions/37230740/heroku-crashing-with-rails-5-rc1