当前位置:  开发笔记 > 编程语言 > 正文

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

如何解决《将Rails应用程序部署到Heroku时出现语法错误:ExecJS::RuntimeError:SyntaxError:Unexpectedcharacter》经验,为你挑选了2个好方法。

我正在尝试将我的应用程序部署到Heroku,但它给我这个错误.

"ExecJS :: RuntimeError:SyntaxError:意外字符'''(行:14577,col:33,pos:440811"

我认为coffeescript/javascript有问题.我删除了所有的coffeescript文件,我不知道我做错了什么.

正如Iceman所说,我试过运行命令

rake资产:预编译RAILS_ENV =开发

它说

我,[2017-01-26T16:32:25.173928#2674]信息 - :写作>/Users/Gana/Documents/bombay/bombaydarbar/public/assets/circle-> cb2239e32deac2eba5c693c3574b562595f1f933a8896866e47c170bf87c77e4.pngI,[2017-01-26T16 :32:25.209986#2674]信息 - :写作>/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fb-> e361b3ecca9c24c6c05646b170fe25fcc185fa2eafb7aa46780253c8a9c79a04.png I,[2017-01-26T16:32:25.225079#2674] INFO - :写作>/Users/Gana/Documents/bombay/bombaydarbar/public/assets/los-> f083228761f6ede67e04a1a73906b4585bc5cfd3154ffec4861c4f04cf95aa32.jpg I,[2017-01-26T16:32:25.253212#2674]信息 - :写作>/Users/Gana/Documents/bombay/bombaydarbar/public/assets/main-> 221235002689ad3847a67a05ce3608ebed4ee709be6fcf61bc0ccef2001b487f.jpg I,[2017-01-26T16:32:25.272155#2674]信息 - :写作/用户/ Gana/Documents/bombay/bombaydarbar/public /assets/us-background-638489d758e08327ad62f883f11397bc870df84038b502ea17c3e2510cac6ef4.jpg I,[2017-01-26T16:32:25.313969#2674]信息 - :写作 g /Users/Gana/Documents/bombay/bombaydarbar/public/assets/zaisan-5f83c22eef3372c96199aad34ab9ad1744d6124e845a01267fcabcec39e2e948.jpg I,[2017-01-26T16:32:25.426829#2674]信息 - :写作/用户/ 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]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-8b6461ded0e51f6232fa5606fc47c47cd9b64684fbbeccd9fed16d7a0a66deee.css I,[2017-01- 26T16:32:25.540807#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/application-8b6461ded0e51f6232fa5606fc47c47cd9b64684fbbeccd9fed16d7a0a66deee.css.gz I,[2017-01-26T16:32:25.543684#2674]信息 - :写作/用户/ Gana/Documents/bombay/bomba ydarbar/public/assets/fontawesome-webfont-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot I,[2017-01-26T16:32:25.597933#2674]信息 - :写作/用户/ Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome- web字体-7bfcab6db99d5cfbf1705ca0536ddc78585432cc5fa41bbd7ad0f009033b2979.eot.gz I,[2017-01-26T16:32:25.601098#2674] INFO - :写入/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 I,[2017-01-26T16: 32:25.675384#2674]信息 - :写/Users/Gana/Documents/bombay/bombaydarbar/public/assets/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf I,[2017-01-26T16:32:25.716776#2674]信息 - - :Writing/Users/Gana/Documents/b ombay/bombaydarbar/public/assets/fontawesome-webfont-aa58f33f239a0fb02f5c7a6c45c043d7a9ac9a093335806694ecd6d4edc0d6a8.ttf.gz I,[2017-01-26T16:32:25.721169#2674]信息 - :写作/用户/ Gana/Documents/bombay/bombaydarbar/public /资产/ fontawesome-web字体-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4.svg I,[2017-01-26T16:32:25.808396#2674] INFO - :书写/用户/加纳/文档/孟买/ bombaydarbar /公共/资产/ fontawesome-web字体-ad6157926c1622ba4e1d03d478f1541368524bfc46f51e42fe0d945f7ef323e4. svg.gz

我的图像文件有问题吗?



1> Ali Haris..:

正如一些用户所提到的,问题是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)



2> 小智..:

我面临类似的错误,似乎Rails JS uglifier无法处理ES6模板文字.您可能需要将"`"(模板文字)替换为单引号或双引号.如果你想验证,请复制粘贴你有问题的JS(你必须在你的JS目录中搜索"`")文件https://jscompress.com/并查看错误.

推荐阅读
mylvfamily
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有