问题-NoMethodError:未定义的方法“ start_with?”对于nil:NilClass

时间:2019-02-27 11:10:31

标签: ruby-on-rails asset-pipeline uglifier

在预编译生产中的资产时,我遇到了NoMethodError: undefined method start_with?' for nil:NilClass错误。

uglifier似乎是一个问题,我正在使用以下宝石:

  

导轨(5.2.2)

     

uglifier(4.1.9)

     

链轮导轨(3.2.1)

     

通奸者(0.12.3)

日志跟踪:

** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke yarn:install (first_time)
** Execute yarn:install
yarn install v1.13.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.36s.
** Execute assets:precompile
rake aborted!
NoMethodError: undefined method `start_with?' for nil:NilClass
/usr/lib64/ruby/gems/2.4.0/gems/uglifier-4.1.9/lib/uglifier.rb:225:in `error_message'
/usr/lib64/ruby/gems/2.4.0/gems/uglifier-4.1.9/lib/uglifier.rb:234:in `parse_result'
/usr/lib64/ruby/gems/2.4.0/gems/uglifier-4.1.9/lib/uglifier.rb:216:in `run_uglifyjs'
/usr/lib64/ruby/gems/2.4.0/gems/uglifier-4.1.9/lib/uglifier.rb:168:in `compile'
/usr/lib64/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/compressing.rb:65:in `block in js_compressor='
/usr/lib64/ruby/gems/2.4.0/gems/sprockets-3.7.1/lib/sprockets/legacy_proc_processor.rb:31:in `call'

我检查了报告here的类似问题,但是将config.assets.js_compressor = Uglifier.new(harmony: true, compress: { unused: false })添加到config/environments/production.rb并不能解决问题。

任何解决该问题的线索将不胜感激。谢谢!

1 个答案:

答案 0 :(得分:0)

这是一个问题https://github.com/lautis/uglifier/issues/137

始终在“宝石”页面上检查“问题”