添加操作文本后,预编译资产失败

我尝试通过以下操作添加操作文本:https://stackoverflow.com/a/55983943

在开发中一切正常。

但是当我尝试通过运行git push heroku将其推送到heroku时,出现此错误:

remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected,failed to compile Ruby app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !   Push rejected to sampleapp.
remote:
remote:
To https://git.heroku.com/sampleapp.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/sampleapp.git'

我尝试添加

config.assets.initialize_on_precompile = false

到config / application.rb,但是没有用

它已经添加到config / environments / production.rb。

我尝试运行RAILS_ENV =生产捆绑包exec rake资产:预编译 但这给了我这个错误:

ExecJS::RuntimeError: SyntaxError: Unexpected token: string (actiontext)
JS_Parse_Error.get ((execjs):3538:621)

那么,如何解决此错误?

tcl1011 回答:添加操作文本后,预编译资产失败

这听起来有些愚蠢,但我现在解决了这个问题。

有效的方法正在改变

config.assets.js_compressor = :uglifier

在config / environments / production.rb中

config.assets.js_compressor = Uglifier.new(harmony: true)
本文链接:https://www.f2er.com/3164616.html

大家都在问