Rake'资产:预编译'未能部署到AWS

时间:2017-03-01 07:35:11

标签: ruby-on-rails amazon-web-services ruby-on-rails-5

我尝试使用Capistrano将我的Rails应用程序部署到AWS。

在我运行cap production deploy之后,我收到了一条'Rake Aborted'消息,其中包含以下内容:

ExecJS::ProgramError: SyntaxError: Unexpected character '’' (line: 19420, col: 10, pos: 548371)

Error
    at new JS_Parse_Error (<eval>:3623:11948)
    at js_error (<eval>:3623:12167)
    at parse_error (<eval>:3623:14184)
    at Object.next_token [as input] (<eval>:3623:19902)
    at next (<eval>:3623:21852)
    at subscripts (<eval>:3624:1389)
    at expr_atom (<eval>:3623:31205)
    at maybe_unary (<eval>:3624:1752)
    at expr_ops (<eval>:3624:2523)
    at maybe_conditional (<eval>:3624:2615)
new JS_Parse_Error ((execjs):3623:11948)
js_error ((execjs):3623:12167)
parse_error ((execjs):3623:14184)
Object.next_token [as input] ((execjs):3623:19902)
next ((execjs):3623:21852)
subscripts ((execjs):3624:1389)
expr_atom ((execjs):3623:31205)
maybe_unary ((execjs):3624:1752)
expr_ops ((execjs):3624:2523)
maybe_conditional ((execjs):3624:2615)
/Users/apple/.rvm/gems/ruby-2.3.3/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:47:in `rescue in block in call'
/Users/apple/.rvm/gems/ruby-2.3.3/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:44:in `block in call'
/Users/apple/.rvm/gems/ruby-2.3.3/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:75:in `block in lock'
/Users/apple/.rvm/gems/ruby-2.3.3/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:73:in `Locker'
/Users/apple/.rvm/gems/ruby-2.3.3/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:73:in `lock'
/Users/apple/.rvm/gems/ruby-2.3.3/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:43:in `call'
/Users/apple/.rvm/gems/ruby-2.3.3/gems/uglifier-3.0.4/lib/uglifier.rb:184:in `run_uglifyjs'
/Users/apple/.rvm/gems/ruby-2.3.3/gems/uglifier-3.0.4/lib/uglifier.rb:146:in `compile'

这不会给我一个语法错误的特定位置,我该如何找到它? 提前谢谢!

1 个答案:

答案 0 :(得分:4)

一种更通用的方法来查找使用此代码的问题:

运行rails console

JS_PATH = "app/assets/javascripts/**/*.js"; 
Dir[JS_PATH].each do |file_name|
  puts "\n#{file_name}"
  puts Uglifier.compile(File.read(file_name))
end

它会显示文件和Uglifier出现问题的行。

相关问题