将 Rails 应用程序部署到 Heroku 时出现语法错误:ExecJS::RuntimeError: SyntaxError: Unexpected character
我正在尝试将我的应用程序部署到 Heroku,但它向我抛出了这个错误.
I am trying to deploy my app to Heroku but its throwing me this error.
"ExecJS::RuntimeError: SyntaxError: Unexpected character '`' (line:14577,列:33,位置:440811"
"ExecJS::RuntimeError: SyntaxError: Unexpected character '`' (line: 14577, col: 33, pos: 440811"
我认为coffeescript/javascript 有问题.我已经删除了所有的咖啡脚本文件,但我不知道自己做错了什么.
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.
按照 Iceman 的建议,我尝试运行该命令
As suggested by Iceman, ive tried running the command
rake assets:预编译 RAILS_ENV=development
rake assets:precompile RAILS_ENV=development
它说
我,[2017-01-26T16:32:25.173928 #2674] INFO -- : Writing >/Users/Gana/Documents/bombay/bombaydarbar/public/assets/circle->cb2239e32deac2eba5c693c3574b562595f1f933a88968866e47c170我,[2017-01-26T16:32:25.209986 #2674] INFO -- : 写作 >/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fb->e361b3ecca9c24c6c05646b170fe25fcc185fa2eafb7aa46780253c8a9c790a我,[2017-01-26T16:32:25.225079 #2674] INFO -- : Writing >/Users/Gana/Documents/bombay/bombaydarbar/public/assets/los->f083228761f6ede67e04a1a73906b4585bc5cfd3154ffec48261c4f04cf95aa3.jpg我,[2017-01-26T16:32:25.253212 #2674] INFO -- : Writing >/Users/Gana/Documents/bombay/bombaydarbar/public/assets/main->221235002689ad3847a67a05ce3608ebed4ee709be6fcf61bc0ccef2001b487f.jpg我,[2017-01-26T16:32:25.272155 #2674] INFO -- : Writing/Users/Gana/Documents/bombay/bombaydarbar/public/assets/us-background-638489d758e08327ad62f883f11397bc870df84038b502ea147c3e2510cac我,[2017-01-26T16:32:25.313969 #2674] INFO -- : Writing/Users/Gana/Documents/bombay/bombaydarbar/public/assets/zaisan-5f83c22eef3372c96199aad34ab9ad1744d6124e845a01267fcabcec39e2e948.jpg我,[2017-01-26T16:32:25.426829 #2674] INFO -- : Writing/Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-cadb51eb7487d2788eae31912fc18cc28ffaf8d48ea022d2a8a49c121415d7f8.js我,[2017-01-26T16:32:25.427380 #2674] INFO -- : Writing/Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-cadb51eb7487d2788eae31912fc18cc28ffaf8d48ea022d2a8a49c121415d7f8.js.我,[2017-01-26T16:32:25.540537 #2674] INFO -- : Writing/Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-8b6461ded0e51f6232fa5606fc47c47cd9b64684fbbeccd9fed16d7a0a66deee.css我,[2017-01-26T16:32:25.540807 #2674] INFO -- : Writing/Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-8b6461ded0e51f6232fa5606fc47c47cd9b64684fbbeccd9fed16d7a0a66deee.css.我,[2017-01-26T16:32:25.543684 #2674] 信息 -- : 写作/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b27我,[2017-01-26T16:32:25.597933 #2674] INFO -- : Writing/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b27.我,[2017-01-26T16:32:25.601098 #2674] 信息——:写作/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33daoff31我,[2017-01-26T16:32:25.638449 #2674] 信息——:写作/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa227408a8a753我,[2017-01-26T16:32:25.675384 #2674] 信息 -- : 写作/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a0933335806694ecdfd6d6d我,[2017-01-26T16:32:25.716776 #2674] 信息 -- : 写作/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a0933335806694ecdf.g46d我,[2017-01-26T16:32:25.721169 #2674] 信息 -- : 写作/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945e我,[2017-01-26T16:32:25.808396 #2674] INFO -- : Writing/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d94g.f>
I, [2017-01-26T16:32:25.173928 #2674] INFO -- : Writing >/Users/Gana/Documents/bombay/bombaydarbar/public/assets/circle->cb2239e32deac2eba5c693c3574b562595f1f933a8896866e47c170bf87c77e4.png I, [2017-01-26T16:32:25.209986 #2674] INFO -- : Writing >/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fb->e361b3ecca9c24c6c05646b170fe25fcc185fa2eafb7aa46780253c8a9c79a04.png I, [2017-01-26T16:32:25.225079 #2674] INFO -- : Writing >/Users/Gana/Documents/bombay/bombaydarbar/public/assets/los->f083228761f6ede67e04a1a73906b4585bc5cfd3154ffec4861c4f04cf95aa32.jpg I, [2017-01-26T16:32:25.253212 #2674] INFO -- : Writing >/Users/Gana/Documents/bombay/bombaydarbar/public/assets/main->221235002689ad3847a67a05ce3608ebed4ee709be6fcf61bc0ccef2001b487f.jpg I, [2017-01-26T16:32:25.272155 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/us-background-638489d758e08327ad62f883f11397bc870df84038b502ea17c3e2510cac6ef4.jpg I, [2017-01-26T16:32:25.313969 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/zaisan-5f83c22eef3372c96199aad34ab9ad1744d6124e845a01267fcabcec39e2e948.jpg I, [2017-01-26T16:32:25.426829 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-cadb51eb7487d2788eae31912fc18cc28ffaf8d48ea022d2a8a49c121415d7f8.js I, [2017-01-26T16:32:25.427380 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-cadb51eb7487d2788eae31912fc18cc28ffaf8d48ea022d2a8a49c121415d7f8.js.gz I, [2017-01-26T16:32:25.540537 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-8b6461ded0e51f6232fa5606fc47c47cd9b64684fbbeccd9fed16d7a0a66deee.css I, [2017-01-26T16:32:25.540807 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-8b6461ded0e51f6232fa5606fc47c47cd9b64684fbbeccd9fed16d7a0a66deee.css.gz I, [2017-01-26T16:32:25.543684 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot I, [2017-01-26T16:32:25.597933 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot.gz I, [2017-01-26T16:32:25.601098 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-2adefcbc041e7d18fcf2d417879dc5a09997aa64d675b7a3c4b6ce33da13f3fe.woff2 I, [2017-01-26T16:32:25.638449 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-ba0c59deb5450f5cb41b3f93609ee2d0d995415877ddfa223e8a8a7533474f07.woff I, [2017-01-26T16:32:25.675384 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf I, [2017-01-26T16:32:25.716776 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf.gz I, [2017-01-26T16:32:25.721169 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg I, [2017-01-26T16:32:25.808396 #2674] INFO -- : Writing /Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg.gz
我的图片文件有问题吗?
is there something wrong with my image files?
推荐答案
正如一些用户提到的,问题是 Rails JS uglifier 无法处理 ES6 模板文字.
The problem, as some of the users has mentioned, is Rails JS uglifier not being able to handle ES6 template literals.
Uglifier 现在具有支持 ES6/ES2015+ 语法的 Harmony 模式.
Uglifier now has a Harmony mode which supports ES6 / ES2015+ syntax.
您可以通过传递 :harmony => 来启用它.true
选项到 Uglifier.
You can enable it by passing :harmony => true
option to Uglifier.
打开config/environments/production.rb
替换
config.assets.js_compressor = :uglifier
与
config.assets.js_compressor = Uglifier.new(harmony: true)
相关文章