1

I am trying to deploy to my staging server and all of a sudden I am getting the following error

V8::Error: SyntaxError: Unexpected token: punc (})
at js_error (<eval>:3623:12167) 
at croak (<eval>:3623:22038)
at token_error (<eval>:3623:22175)
at unexpected (<eval>:3623:22263)
at <eval>:3623:23996
at <eval>:3623:22954
at <eval>:3624:3759
at parse (<eval>:3624:3999)
at parse (<eval>:3958:22)
at uglifier (<eval>:4003:13)
/var/www/fdsa/fdsa/bundle/ruby/2.3.0/gems/execjs-2.7.0/lib/execjs/ruby_racer_runtime.rb:45:in `block in call'

Tasks: TOP => assets:precompile

I have run this rails code but everything looks to be ok I get no error for any of the javascript files.

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

https://stackoverflow.com/questions/12574977/rake-assetsprecompile-gives-punc-error/38228770#38228770
Petran
  • 7,677
  • 22
  • 65
  • 104

1 Answers1

0

I got the same error and figured out why. This was because of using old Angular syntax format to find the record from json in angular which is deprecated and not supported with rails 4 and later version.

Syntax not supported:

Json_data.find(item => item.field_name == 'abc'). 
Jean-François Corbett
  • 37,420
  • 30
  • 139
  • 188
S.D
  • 485
  • 5
  • 8