RoR Precompiling Assets fail while rake assets:precompile - on basically empty application.js

前端 未结 2 677
别跟我提以往
别跟我提以往 2021-01-04 22:57

Running:

bundle exec rake assets:precompile RAILS_ENV=production --trace

** Execute assets:precompile:primary
rake aborted!
TypeError: Object doesn\'t suppo         


        
相关标签:
2条回答
  • 2021-01-04 23:44

    I got same sort of error

    ...>rake assets:precompile
    C:/Ruby192/bin/ruby.exe C:/Ruby192/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
    ...
    rake aborted!
    TypeError: Object doesn't support this property or method
      (in C:/Users/straffordw/railsApps/chorus-spp/app/assets/javascripts/application.js)
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:68:in `extract_result'
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:28:in `block in exec'
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:27:in `exec'
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/uglifier-2.0.1/lib/uglifier.rb:167:in `really_compile'
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/uglifier-2.0.1/lib/uglifier.rb:95:in `compile'
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/actionpack-3.2.11/lib/sprockets/compressors.rb:74:in `compress'
    C:/Ruby192/lib/ruby/gems/1.9.1/gems/sprockets-2.2.2/lib/sprockets/processing.rb:265:in `block in js_compressor='
    ...
    

    and did

    bundle update
    

    which brought in

    uglifier (2.1.1)
    

    (amongst other things), then:

    rake assets:precompile
    

    and that resolved my problem. Windows, Rails 3.2.11.

    0 讨论(0)
  • 2021-01-04 23:51

    Looks like it might be a problem with uglifier and Windows Script Host:

    https://github.com/rails/rails/issues/2847

    Make sure you're using the last version of uglifier (1.0.4). If you're still having problems, I'd suggest trying a different compiler (e.g. Closure compiler)

    In Gemfile:

    gem 'closure-compiler'
    

    In config/environments/production.rb

    config.assets.js_compressor = :closure
    

    alternatively disable JS compression altogether:

    config.assets.compress = false
    
    0 讨论(0)
提交回复
热议问题