【问题标题】:Precompiling assets failed after adding action text添加操作文本后预编译资产失败
【发布时间】:2019-11-04 18:07:19
【问题描述】:

我尝试按照以下方式添加操作文本: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=production bundle exec rake assets:precompile 但它给了我这个错误:

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

那么,我该如何解决这个错误呢?

【问题讨论】:

    标签: ruby-on-rails heroku


    【解决方案1】:

    这可能听起来很愚蠢,但我现在解决了这个问题。

    有效的是改变

    config.assets.js_compressor = :uglifier
    

    在 config/environments/production.rb 到

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多