我正在尝试将我的应用程序部署到Heroku,但它给我这个错误。
" ExecJS :: RuntimeError:SyntaxError:意外字符'`' (线: 14577,col:33,pos:440811"
我认为coffeescript / javascript有问题。我删除了所有的coffeescript文件,但我不知道我做错了什么。
正如Iceman所说,我已经尝试过运行命令
rake assets:预编译RAILS_ENV =开发
它说
I,[2017-01-26T16:32:25.173928#2674]信息 - :写作> / Users / Gana / Documents / bombay / bombaydarbar / public / assets / circle-> cb2239e32deac2eba5c693c3574b562595f1f933a8896866e47c170bf87c77e4.png 我,[2017-01-26T16:32:25.209986#2674]信息 - :写作> / Users / Gana / Documents / bombay / bombaydarbar / public / assets / fb-> e361b3ecca9c24c6c05646b170fe25fcc185fa2eafb7aa46780253c8a9c79a04.png 我,[2017-01-26T16:32:25.225079#2674]信息 - :写作> / Users / Gana / Documents / bombay / bombaydarbar / public / assets / los-> f083228761f6ede67e04a1a73906b4585bc5cfd3154ffec4861c4f04cf95aa32.jpg 我,[2017-01-26T16:32:25.253212#2674]信息 - :写作> / Users / Gana / Documents / bombay / bombaydarbar / public / assets / main-> 221235002689ad3847a67a05ce3608ebed4ee709be6fcf61bc0ccef2001b487f.jpg 我,[2017-01-26T16:32:25.272155#2674]信息 - :写作/Users/Gana/Documents/bombay/bombaydarbar/public/assets/us-background-638489d758e08327ad62f883f11397bc870df84038b502ea17c3e2510cac6ef4.jpg 我,[2017-01-26T16:32:25.313969#2674]信息 - :写作/Users/Gana/Documents/bombay/bombaydarbar/public/assets/zaisan-5f83c22eef3372c96199aad34ab9ad1744d6124e845a01267fcabcec39e2e948.jpg 我,[2017-01-26T16:32:25.426829#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-cadb51eb7487d2788eae31912fc18cc28ffaf8d48ea022d2a8a49c121415d7f8.js 我,[2017-01-26T16:32:25.427380#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-cadb51eb7487d2788eae31912fc18cc28ffaf8d48ea022d2a8a49c121415d7f8.js.gz 我,[2017-01-26T16:32:25.540537#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-8b6461ded0e51f6232fa5606fc47c47cd9b64684fbbeccd9fed16d7a0a66deee.css 我,[2017-01-26T16:32:25.540807#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-8b6461ded0e51f6232fa5606fc47c47cd9b64684fbbeccd9fed16d7a0a66deee.css.gz 我,[2017-01-26T16:32:25.543684#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot 我,[2017-01-26T16:32:25.597933#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot.gz 我,[2017-01-26T16:32:25.601098#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2 我,[2017-01-26T16:32:25.638449#2674]信息 - :写作/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff 我,[2017-01-26T16:32:25.675384#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf 我,[2017-01-26T16:32:25.716776#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf.gz 我,[2017-01-26T16:32:25.721169#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg 我,[2017-01-26T16:32:25.808396#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg.gz
我的图片文件有问题吗?
答案 0 :(得分:14)
正如一些用户所提到的,问题是Rails JS uglifier无法处理ES6模板文字。
Uglifier现在具有Harmony模式,支持ES6 / ES2015 +语法。
您可以通过将:harmony => true
选项传递给Uglifier来启用它。
打开config/environments/production.rb
替换
config.assets.js_compressor = :uglifier
与
config.assets.js_compressor = Uglifier.new(harmony: true)
答案 1 :(得分:7)
我遇到了类似的错误,似乎Rails JS uglifier无法处理ES6 template literals。您可能需要将“`”(模板文字)替换为单引号或双引号。 如果你想验证,请复制粘贴你有问题的JS(你必须在你的JS目录中搜索“`”)文件https://jscompress.com/并查看错误。