将Rails应用程序部署到Heroku时的语法错误

将Rails应用程序部署到Heroku时的语法错误

本文介绍了将Rails应用程序部署到Heroku时的语法错误:ExecJS :: RuntimeError:SyntaxError:意外字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将我的应用程序部署到Heroku,但是它引发了这个错误。

我认为这是错误的



根据Iceman的建议,我尝试运行该命令

它说

我的图像文件有问题吗?

解决方案

正如一些用户提到的,问题是Rails JS uglifier无法处理ES6模板文字。



Uglifier现在具有支持ES6 / ES2015 +语法的Harmony模式。



您可以通过传递:harmony =>来启用它

打开 config / environments / production.rb

p>

替换

  config.assets.js_compressor =:uglifier 

  config.assets.js_compressor = Uglifier.new(harmony:true)


I am trying to deploy my app to Heroku but its throwing me this error.

I assume there is something wrong with the coffeescript/javascript. I have deleted all of my coffeescript files and I dont know what I'm doing wrong.

As suggested by Iceman, ive tried running the command

and it says

is there something wrong with my image files?

解决方案

The problem, as some of the users has mentioned, is Rails JS uglifier not being able to handle ES6 template literals.

Uglifier now has a Harmony mode which supports ES6 / ES2015+ syntax.

You can enable it by passing :harmony => true option to Uglifier.

Open config/environments/production.rb

Replace

config.assets.js_compressor = :uglifier

with

config.assets.js_compressor = Uglifier.new(harmony: true)

这篇关于将Rails应用程序部署到Heroku时的语法错误:ExecJS :: RuntimeError:SyntaxError:意外字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 00:54