0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【Rails】「Uglifier::Error: Unexpected character '`'」の解決方法

Posted at

#開発環境

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

事象

Capistranoでデプロイした際に下記エラーが発生

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

原因

JavaScriptファイル内で記述していたテンプレートリテラルのバッククォート(`)が原因でした。

解決方法

production.rbの27行目をコメントアウトする。

production.rb
# config.assets.js_compressor = :uglifier
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?