[英]git: ExecJS::ProgramError: Unexpected token: name (jquery) when push to production environment
I've tried git push
to a hosting service (not heroku). 我试过
git push
到托管服务(不是heroku)。 I typed the following commands on Windows. 我在Windows上键入了以下命令。
rake assets:precompile
git add .
git commit -m "xxx"
git push origin master
Then the following error is displayed on the hosting service screen. 然后在主机服务屏幕上显示以下错误。
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'
.
.
.
Although there is the file name noimage-9f9de98ce95d5c9108e75feb33a04e35.gif
on the first line of the error message, I saved app\\assets\\images\\noimage.gif
locally. 尽管错误消息的第一行上有文件名
noimage-9f9de98ce95d5c9108e75feb33a04e35.gif
,但我在本地保存了app\\assets\\images\\noimage.gif
。
Does this have something to do with the error? 这与错误有关吗?
There are some files in \\app\\assets\\javascripts
. \\app\\assets\\javascripts
有一些文件。
application.js 的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 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')
)
There are some other js.coffee files, but they don't have any code as below. 还有其他一些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/
How do I fix this problem? 我该如何解决这个问题?
I think noimage-9f9de98ce95d5c9108e75feb33a04e35.gif
is a red herring--that's just the last successful log line before the error. 我认为
noimage-9f9de98ce95d5c9108e75feb33a04e35.gif
是一个红色鲱鱼,它只是错误之前的最后一个成功日志行。
That require
statement at the end of your application.js should have a leading //=
, I believe. 我认为application.js末尾的
require
语句应该有一个前导//=
。 It's definitely not valid JS as written. 绝对不是写的有效JS。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.