我已尝试git push
到托管服务(不是heroku)。我在Windows上键入以下命令。
rake assets:precompile
git add .
git commit -m "xxx"
git push origin master
然后主机服务屏幕上显示以下错误。
I, [2014-11-08T09:28:48.280141 #22295] INFO -- : Writing /var/repos/xxx/xxx/public/assets/noimage-9f9de98ce95d5c9108e75feb33a04e35.gif
rake aborted!
ExecJS::ProgramError: Unexpected token: name (jquery) (line: 12946, col: 8, pos: 364216)
Error
at new JS_Parse_Error (<eval>:2316:10736)
at js_error (<eval>:2316:10955)
at croak (<eval>:2316:18665)
at token_error (<eval>:2316:18802)
at unexpected (<eval>:2316:18890)
at semicolon (<eval>:2316:19363)
at simple_statement (<eval>:2316:21849)
at <eval>:2316:20090
at <eval>:2316:19536
at <eval>:2316:31209
(in /var/repos/xxx/xxx/app/assets/javascripts/application.js)/var/repos/xxx/xxx/vendor/bundle/ruby/2.1.0/gems/execjs-2.0.2/lib/execjs/ruby_racer_runtime.rb:34:in `rescue in block in eval'
/var/repos/xxx/xxx/vendor/bundle/ruby/2.1.0/gems/execjs-2.0.2/lib/execjs/ruby_racer_runtime.rb:28:in `block in eval'
/var/repos/xxx/xxx/vendor/bundle/ruby/2.1.0/gems/execjs-2.0.2/lib/execjs/ruby_racer_runtime.rb:80:in `block in lock'
/var/repos/xxx/xxx/vendor/bundle/ruby/2.1.0/gems/therubyracer-0.10.2/lib/v8/c/locker.rb:13:in `Locker'
/var/repos/xxx/xxx/vendor/bundle/ruby/2.1.0/gems/execjs-2.0.2/lib/execjs/ruby_racer_runtime.rb:78:in `lock'
/var/repos/xxx/xxx/vendor/bundle/ruby/2.1.0/gems/execjs-2.0.2/lib/execjs/ruby_racer_runtime.rb:27:in `eval'
.
.
.
虽然错误消息的第一行有文件名noimage-9f9de98ce95d5c9108e75feb33a04e35.gif
,但我在本地保存了app\assets\images\noimage.gif
。
这是否与错误有关?
\app\assets\javascripts
中有一些文件。
的application.js
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require bootstrap
//= require turbolinks
//= require_tree .
require jquery.turbolinks
calendars.js.coffee
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
$(document).ready( ->
$('html, body').animate({ scrollTop: 0 }, 'slow')
)
还有其他一些js.coffee文件,但它们没有任何代码,如下所示。
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
如何解决此问题?
答案 0 :(得分:1)
我认为noimage-9f9de98ce95d5c9108e75feb33a04e35.gif
是一个红色的鲱鱼 - 这只是错误发生前最后一次成功的日志行。
我相信,你的application.js末尾的require
语句应该有一个前导//=
。这绝对不是JS写的有效。