gpt4 book ai didi

javascript - 将 Rails 应用程序部署到 Heroku 时出现语法错误:ExecJS::RuntimeError: SyntaxError: Unexpected character

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:49:40 27 4
gpt4 key购买 nike

我正在尝试将我的应用程序部署到 Heroku,但它向我抛出此错误。

"ExecJS::RuntimeError: SyntaxError: Unexpected character '`' (line: 14577, col: 33, pos: 440811"

我假设 coffeescript/javascript 有问题。我删除了我所有的 coffeescript 文件,但我不知道自己做错了什么。

按照冰人的建议,我试过运行命令

rake assets:precompile RAILS_ENV=development

它说

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

我的图像文件有问题吗?

最佳答案

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

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

您可以通过将 :harmony => true 选项传递给 Uglifier 来启用它。

打开config/environments/production.rb

替换

config.assets.js_compressor = :uglifier

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

关于javascript - 将 Rails 应用程序部署到 Heroku 时出现语法错误:ExecJS::RuntimeError: SyntaxError: Unexpected character,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41883113/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com