[Rails] How to solve "Uglifier :: Error: Unexpected character'`'"

Development environment

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


The following error occurs when deploying with Capistrano


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


It was caused by the backticks (`) of the template literal that was written in the JavaScript file.


Comment out line 27 of production.rb.


# config.assets.js_compressor = :uglifier

Recommended Posts

[Rails] How to solve "Uglifier :: Error: Unexpected character'`'"
[Rails] How to display error messages individually
How to write Rails
How to uninstall Rails
[Rails] How to get success and error messages
[rails] How to post images
[Rails] How to use enum
[Rails] How to use enum
How to read rails routes
How to use rails join
How to terminate rails server
How to write Rails seed
[Rails] How to use validation
[Rails] How to disable turbolinks
[Rails] How to use authenticate_user!
[Rails] How to implement scraping
[Rails] How to make seed
How to write Rails routing
[Rails] How to install simple_calendar
[Rails] How to install reCAPTCHA
[Rails] How to use Scope
[Rails] How to solve the error "undefined method` visit'" when using Capybara with Rspec
[Rails] How to use gem "devise"
[Rails] How to use devise (Note)
[Rails] How to use flash messages
[rails] How to display db information
[Rails] Unexpected validation error in devise
[Rails] How to prevent screen transition
How to enclose any character with "~"
How to use Ruby on Rails
How to deploy Bootstrap on Rails
[Rails] How to speed up docker-compose
[Rails] How to add new pages
[Rails] How to write exception handling?
[Rails] How to install ImageMagick (RMajick)
[Rails] How to install Font Awesome
[Rails] How to use Active Storage
How to introduce jQuery in Rails 6
[Rails] How to implement star rating
[Introduction to Rails] How to use render
[Rails] syntax error, unexpected tSTRING_END, expecting'''
How to install Swiper in Rails
[Rails / RSpec] How to deal with element has zero size error
[Ruby version error] How to solve Your Ruby version is ~, but your Gemfile specified ~
[Rails] How to omit the display of the character string of the link_to method
[Rails] About Uglifier :: Error: Unexpected token: at the time of deployment
How to solve the unknown error when using slf4j in Java
How to implement search functionality in Rails
How to change app name in rails
[Rails] How to convert from erb to haml
How to put out the error bundling
How to insert a video in Rails
[Rails] How to use ActiveRecord :: Bitemporal (BiTemporalDataModel)
[Rails] How to use the map method
[Docker] How to solve the error function not implemented @ io_fread ~ [Super easy]
How to use MySQL in Rails tutorial
How to resolve errors when installing Rails 5.1.3
[rails] How to configure routing in resources
[Ruby on Rails] How to use redirect_to
[rails] How to create a partial template
How to solve the local environment construction of Ruby on Rails (MAC)!