RAILS_ENV=production rake assets:precompile --trace
Digest::Digest is deprecated; use Digest
Digest::Digest is deprecated; use Digest
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
ExecJS::RuntimeError: SyntaxError: Unexpected token operator «=», expected punc «,» (line: 159, col: 25, pos: 5132)
Error
at new JS_Parse_Error (/tmp/execjs20161124-23752-1wuk17bjs:3623:11948)
at js_error (/tmp/execjs20161124-23752-1wuk17bjs:3623:12167)
at croak (/tmp/execjs20161124-23752-1wuk17bjs:3623:22038)
at token_error (/tmp/execjs20161124-23752-1wuk17bjs:3623:22175)
at expect_token (/tmp/execjs20161124-23752-1wuk17bjs:3623:22411)
at expect (/tmp/execjs20161124-23752-1wuk17bjs:3623:22562)
at ctor.argnames (/tmp/execjs20161124-23752-1wuk17bjs:3623:27486)
at function_ (/tmp/execjs20161124-23752-1wuk17bjs:3623:27550)
at /tmp/execjs20161124-23752-1wuk17bjs:3623:24469
at /tmp/execjs20161124-23752-1wuk17bjs:3623:22954
new JS_Parse_Error ((execjs):3623:11948)
js_error ((execjs):3623:12167)
croak ((execjs):3623:22038)
token_error ((execjs):3623:22175)
expect_token ((execjs):3623:22411)
expect ((execjs):3623:22562)
ctor.argnames ((execjs):3623:27486)
function_ ((execjs):3623:27550)
(execjs):3623:24469
(execjs):3623:22954
/usr/local/rvm/gems/ruby-2.3.1/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:39:in `exec'
/usr/local/rvm/gems/ruby-2.3.1/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:21:in `eval'
/usr/local/rvm/gems/ruby-2.3.1/gems/execjs-2.7.0/lib/execjs/external_runtime.rb:46:in `call'
/usr/local/rvm/gems/ruby-2.3.1/gems/uglifier-3.0.3/lib/uglifier.rb:182:in `run_uglifyjs'
/usr/local/rvm/gems/ruby-2.3.1/gems/uglifier-3.0.3/lib/uglifier.rb:144:in `compile'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:52:in `call'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/uglifier_compressor.rb:28:in `call'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:60:in `block in load'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:44:in `load'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `load'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/base.rb:66:in `find_asset'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:142:in `block in find'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `each'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `stat_directory'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:227:in `stat_tree'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `each'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `stat_directory'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:227:in `stat_tree'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `each'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `each'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `logical_paths'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:140:in `find'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:185:in `compile'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/rake/sprocketstask.rb:147:in `with_logger'
/usr/local/rvm/gems/ruby-2.3.1/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:248:in `block in execute'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:243:in `each'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:243:in `execute'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:180:in `invoke_with_call_chain'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:173:in `invoke'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:152:in `invoke_task'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:108:in `each'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:108:in `block in top_level'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:117:in `run_with_threads'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:102:in `top_level'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:80:in `block in run'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:77:in `run'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.1/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.3.1/bin/rake:23:in `<main>'
/usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:precompile
Having the above error and its aborting the assets creation. Any help on how to bypass it as Ajax files on the production is not working.
I know this is old, but I got the same error and I came here from Google, so in case someone does too, this was my solution:
I used this in the console to find the file and the line of the error (took it from this answer):
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
My error was that I was using the new ES6 javascript syntax, not compatible with my asset pre-compilation. In specific, defining default parameters in function definition, so I took the solution from this answer:
Instead of:
function foo(a, b = default_b) {
...
}
Use:
function foo(a, b) {
b = typeof b !== 'undefined' ? b : 'default_b';
...
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With