Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Uglifier - NoMethodError: undefined method `start_with?' for nil:NilClass

I have been facing the NoMethodError: undefined method start_with?' for nil:NilClass error while precompiling assets in production.

This seems to be an issue with uglifier and I am using the following gems:

rails (5.2.2)

uglifier (4.1.9)

sprockets-rails (3.2.1)

therubyracer (0.12.3)

Log trace:

** 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'

I checked the similar issue reported here but adding config.assets.js_compressor = Uglifier.new(harmony: true, compress: { unused: false }) to config/environments/production.rb did not resolve the issue.

Any lead to resolve the issue would be highly appreciated. Thanks!

like image 870
dp7 Avatar asked Nov 07 '22 20:11

dp7


1 Answers

here is an issue https://github.com/lautis/uglifier/issues/137

always check "issues" on gems page

like image 77
Igor Kasyanchuk Avatar answered Nov 12 '22 18:11

Igor Kasyanchuk