[Java] [Rails] How to solve Uglifier::Error: Unexpected character’`’

less than 1 minute read

Development environment

・Ruby: 2.5.7 Rails: 5.2.4 ・Vagrant: 2.2.7 ・VirtualBox: 6.1 ・OS: macOS Catalina

Event

The following error occurred when deploying with Capistrano

terminal


deploy:assets:precompile
01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
01 rake aborted!
01 Uglifier::Error: Unexpected character'`'

Cause

The cause was the backquote (`) of the template literal that was described in the JavaScript file.

Solution

Comment out the 27th line of production.rb.

production.rb


# config.assets.js_compressor = :uglifier