Heroku:预编译资源失败.推送被拒绝,无法编译 Ruby 应用程序



我正在尝试推送并使我的应用程序在 heroku 上上线,但是当我尝试执行git push heroku master时,我收到 ff 错误:

giboapp git:master ❯ git push heroku master                                ⏎
Enumerating objects: 930, done.
Counting objects: 100% (930/930), done.
Delta compression using up to 2 threads
Compressing objects: 100% (645/645), done.
Writing objects: 100% (930/930), 263.37 KiB | 2.29 MiB/s, done.
Total 930 (delta 516), reused 470 (delta 255), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote: 
remote:  !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote:             Detected buildpacks: Ruby,Node.js
remote:             See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Installing bundler 2.0.2
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.6.5
remote: -----> Installing dependencies using bundler 2.0.2
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
remote:        Fetching gem metadata from https://rubygems.org/............
remote:        Fetching rake 13.0.1
remote:        Installing rake 13.0.1
remote:        Fetching concurrent-ruby 1.1.6
remote:        Fetching thread_safe 0.3.6
remote:        Fetching minitest 5.14.1
remote:        Installing minitest 5.14.1
remote:        Installing thread_safe 0.3.6
remote:        Installing concurrent-ruby 1.1.6
remote:        Fetching builder 3.2.4
remote:        Installing builder 3.2.4
remote:        Fetching erubi 1.9.0
remote:        Installing erubi 1.9.0
remote:        Fetching mini_portile2 2.4.0
remote:        Fetching crass 1.0.6
remote:        Installing mini_portile2 2.4.0
remote:        Installing crass 1.0.6
remote:        Fetching rack 2.2.2
remote:        Fetching nio4r 2.5.2
remote:        Installing rack 2.2.2
remote:        Installing nio4r 2.5.2 with native extensions
remote:        Fetching websocket-extensions 0.1.4
remote:        Installing websocket-extensions 0.1.4
remote:        Fetching mini_mime 1.0.2
remote:        Installing mini_mime 1.0.2
remote:        Fetching arel 9.0.0
remote:        Installing arel 9.0.0
remote:        Fetching mimemagic 0.3.5
remote:        Installing mimemagic 0.3.5
remote:        Fetching execjs 2.7.0
remote:        Installing execjs 2.7.0
remote:        Fetching bcrypt 3.1.13
remote:        Installing bcrypt 3.1.13 with native extensions
remote:        Fetching msgpack 1.3.3
remote:        Installing msgpack 1.3.3 with native extensions
remote:        Fetching popper_js 1.16.0
remote:        Installing popper_js 1.16.0
remote:        Fetching method_source 1.0.0
remote:        Installing method_source 1.0.0
remote:        Fetching thor 1.0.1
remote:        Installing thor 1.0.1
remote:        Fetching ffi 1.13.0
remote:        Installing ffi 1.13.0 with native extensions
remote:        Fetching tilt 2.0.10
remote:        Installing tilt 2.0.10
remote:        Using bundler 2.0.2
remote:        Fetching coffee-script-source 1.12.2
remote:        Installing coffee-script-source 1.12.2
remote:        Fetching orm_adapter 0.5.0
remote:        Installing orm_adapter 0.5.0
remote:        Fetching kaminari-core 1.2.0
remote:        Installing kaminari-core 1.2.0
remote:        Fetching pg 1.2.3
remote:        Installing pg 1.2.3 with native extensions
remote:        Fetching puma 3.12.4
remote:        Installing puma 3.12.4 with native extensions
remote:        Fetching rb-fsevent 0.10.4
remote:        Installing rb-fsevent 0.10.4
remote:        Fetching turbolinks-source 5.2.0
remote:        Installing turbolinks-source 5.2.0
remote:        Fetching tzinfo 1.2.7
remote:        Installing tzinfo 1.2.7
remote:        Fetching nokogiri 1.10.9
remote:        Installing nokogiri 1.10.9 with native extensions
remote:        Fetching i18n 1.8.2
remote:        Installing i18n 1.8.2
remote:        Fetching websocket-driver 0.7.2
remote:        Installing websocket-driver 0.7.2 with native extensions
remote:        Fetching rack-test 1.1.0
remote:        Installing rack-test 1.1.0
remote:        Fetching sprockets 3.7.2
remote:        Installing sprockets 3.7.2
remote:        Fetching warden 1.2.8
remote:        Installing warden 1.2.8
remote:        Fetching mail 2.7.1
remote:        Installing mail 2.7.1
remote:        Fetching marcel 0.3.3
remote:        Installing marcel 0.3.3
remote:        Fetching autoprefixer-rails 9.7.4
remote:        Installing autoprefixer-rails 9.7.4
remote:        Fetching uglifier 4.2.0
remote:        Installing uglifier 4.2.0
remote:        Fetching coffee-script 2.4.1
remote:        Installing coffee-script 2.4.1
remote:        Fetching bootsnap 1.4.6
remote:        Installing bootsnap 1.4.6 with native extensions
remote:        Fetching sassc 2.3.0
remote:        Installing sassc 2.3.0 with native extensions
remote:        Fetching rb-inotify 0.10.1
remote:        Installing rb-inotify 0.10.1
remote:        Fetching turbolinks 5.2.1
remote:        Installing turbolinks 5.2.1
remote:        Fetching activesupport 5.2.4.2
remote:        Installing activesupport 5.2.4.2
remote:        Fetching faker 1.9.6
remote:        Installing faker 1.9.6
remote:        Fetching loofah 2.5.0
remote:        Installing loofah 2.5.0
remote:        Fetching sass-listen 4.0.0
remote:        Installing sass-listen 4.0.0
remote:        Fetching rails-dom-testing 2.0.3
remote:        Installing rails-dom-testing 2.0.3
remote:        Fetching globalid 0.4.2
remote:        Installing globalid 0.4.2
remote:        Fetching activemodel 5.2.4.2
remote:        Installing activemodel 5.2.4.2
remote:        Fetching jbuilder 2.10.0
remote:        Installing jbuilder 2.10.0
remote:        Fetching pundit 1.1.0
remote:        Installing pundit 1.1.0
remote:        Fetching rails-html-sanitizer 1.3.0
remote:        Installing rails-html-sanitizer 1.3.0
remote:        Fetching sass 3.7.4
remote:        Installing sass 3.7.4
remote:        Fetching activejob 5.2.4.2
remote:        Installing activejob 5.2.4.2
remote:        Fetching activerecord 5.2.4.2
remote:        Installing activerecord 5.2.4.2
remote:        Fetching actionview 5.2.4.2
remote:        Installing actionview 5.2.4.2
remote:        Fetching actionpack 5.2.4.2
remote:        Installing actionpack 5.2.4.2
remote:        Fetching kaminari-actionview 1.2.0
remote:        Installing kaminari-actionview 1.2.0
remote:        Fetching kaminari-activerecord 1.2.0
remote:        Installing kaminari-activerecord 1.2.0
remote:        Fetching kaminari 1.2.0
remote:        Installing kaminari 1.2.0
remote:        Fetching actionmailer 5.2.4.2
remote:        Fetching actioncable 5.2.4.2
remote:        Installing actionmailer 5.2.4.2
remote:        Installing actioncable 5.2.4.2
remote:        Fetching activestorage 5.2.4.2
remote:        Installing activestorage 5.2.4.2
remote:        Fetching railties 5.2.4.2
remote:        Installing railties 5.2.4.2
remote:        Fetching sprockets-rails 3.2.1
remote:        Installing sprockets-rails 3.2.1
remote:        Fetching coffee-rails 4.2.2
remote:        Fetching responders 3.0.0
remote:        Installing coffee-rails 4.2.2
remote:        Installing responders 3.0.0
remote:        Fetching font-awesome-rails 4.7.0.5
remote:        Fetching jquery-rails 4.3.5
remote:        Installing font-awesome-rails 4.7.0.5
remote:        Installing jquery-rails 4.3.5
remote:        Fetching jquery-ui-rails 6.0.1
remote:        Installing jquery-ui-rails 6.0.1
remote:        Fetching rails 5.2.4.2
remote:        Installing rails 5.2.4.2
remote:        Fetching rails-ujs 0.1.0
remote:        Installing rails-ujs 0.1.0
remote:        Fetching sass-rails 5.1.0
remote:        Installing sass-rails 5.1.0
remote:        Fetching toastr-rails 1.0.3
remote:        Installing toastr-rails 1.0.3
remote:        Fetching devise 4.7.1
remote:        Installing devise 4.7.1
remote:        Fetching sassc-rails 2.1.2
remote:        Installing sassc-rails 2.1.2
remote:        Fetching bootstrap 4.4.1
remote:        Installing bootstrap 4.4.1
remote:        Bundle complete! 29 Gemfile dependencies, 81 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into `./vendor/bundle`
remote:        Post-install message from i18n:
remote:        
remote:        HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
remote:        But that may break your application.
remote:        
remote:        If you are upgrading your Rails application from an older version of Rails:
remote:        
remote:        Please check your Rails app for 'config.i18n.fallbacks = true'.
remote:        If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
remote:        'config.i18n.fallbacks = [I18n.default_locale]'.
remote:        If not, fallbacks will be broken in your app by I18n 1.1.x.
remote:        
remote:        If you are starting a NEW Rails application, you can ignore this notice.
remote:        
remote:        For more info see:
remote:        https://github.com/svenfuchs/i18n/releases/tag/v1.1.0
remote:        
remote:        Post-install message from sass:
remote:        
remote:        Ruby Sass has reached end-of-life and should no longer be used.
remote:        
remote:        * If you use Sass as a command-line tool, we recommend using Dart Sass, the new
remote:          primary implementation: https://sass-lang.com/install
remote:        
remote:        * If you use Sass as a plug-in for a Ruby web framework, we recommend using the
remote:          sassc gem: https://github.com/sass/sassc-ruby#readme
remote:        
remote:        * For more details, please refer to the Sass blog:
remote:          https://sass-lang.com/blog/posts/7828841
remote:        
remote:        Bundle completed (205.46s)
remote:        Cleaning up the bundler cache.
remote: -----> Installing node-v10.15.3-linux-x64
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        Yarn executable was not detected in the system.
remote:        Download Yarn at https://yarnpkg.com/en/docs/install
remote:        I, [2020-06-02T04:42:57.811792 #1618]  INFO -- : Writing /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/public/assets/custom-0f9c6eb8f419d40212aae1b1abd8dd92617ab9a6b297929f414ad07d06d8499c.css
remote:        I, [2020-06-02T04:42:57.812515 #1618]  INFO -- : Writing /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/public/assets/custom-0f9c6eb8f419d40212aae1b1abd8dd92617ab9a6b297929f414ad07d06d8499c.css.gz
remote:        I, [2020-06-02T04:42:57.815816 #1618]  INFO -- : Writing /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/public/assets/100x100-bb24ed89d670dafbdedc9b92250df33b1d7e1ed19a752316576b49ddc59692cd.png
remote:        I, [2020-06-02T04:42:57.817712 #1618]  INFO -- : Writing /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/public/assets/intro-bg-a44085e80be1f8213987eb40045db6f039e02308c0405b5f84874743f1fb2c63.png
remote:        I, [2020-06-02T04:42:57.820262 #1618]  INFO -- : Writing /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/public/assets/intro-img-46db85e95b37abe91c9d7356ab6d975b967b2f6da4fab28edad0106658c51b24.svg
remote:        I, [2020-06-02T04:42:57.821419 #1618]  INFO -- : Writing /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/public/assets/intro-img-46db85e95b37abe91c9d7356ab6d975b967b2f6da4fab28edad0106658c51b24.svg.gz
remote:        I, [2020-06-02T04:42:57.824955 #1618]  INFO -- : Writing /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/public/assets/list-img-e69b310f8037732ce25e835bdeff8185af501e530047c454248935496f3ed5a5.svg
remote:        I, [2020-06-02T04:42:57.825201 #1618]  INFO -- : Writing /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/public/assets/list-img-e69b310f8037732ce25e835bdeff8185af501e530047c454248935496f3ed5a5.svg.gz
remote:        I, [2020-06-02T04:42:57.828445 #1618]  INFO -- : Writing /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/public/assets/logo-e09c3450e5b47daf835806cad4de85b81c66eba28411acfc26072238016c4ab3.png
remote:        I, [2020-06-02T04:42:57.831251 #1618]  INFO -- : Writing /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/public/assets/testimonial-029a9f73596373572da3aa2b3bf601804ae209e0fbc6bb74e81ffcf3a4f374b9.jpg
remote:        rake aborted!
remote:        Uglifier::Error: Unexpected token: name (newOption). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
remote:        --
remote:         38072     $.ajax({
remote:         38073       url: '/categories',
remote:         38074       method: 'post',
remote:         38075       data: {
remote:         38076         category: { name: capitalizeFirstLetter($('#new-category').val()) }
remote:         38077       },
remote:         38078       success: function (category) {
remote:         38079         if (category.id != null) {
remote:            =>           let newOption = $('<option/>')
remote:         38081             .attr('value', category.id)
remote:         38082             .attr('selected', true)
remote:         38083             .text(category.name)
remote:         38084 
remote:         38085           $('#category_select').append(newOption);
remote:         38086           $('#new-category').val('');
remote:         38087         }
remote:         38088       },
remote:        ==
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/uglifier-4.2.0/lib/uglifier.rb:291:in `parse_result'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/uglifier-4.2.0/lib/uglifier.rb:221:in `run_uglifyjs'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/uglifier-4.2.0/lib/uglifier.rb:166:in `compile'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:53:in `call'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/uglifier_compressor.rb:28:in `call'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
remote:        /tmp/build_9bbd97d889fb02756ba5cbdef84e8320/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
remote:        Tasks: TOP => assets:precompile
remote:        (See full trace by running task with --trace)
remote: 
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 giboapp.
remote: 
To https://git.heroku.com/giboapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/giboapp.git'
giboapp git:master ❯                                                       ⏎

作为记录,我正在为我的应用程序使用postgresql

我试图在我的config/application.rb文件上添加此代码:

config.assets.initialize_on_precompile = false

但再次推动后仍然没有工作。

我也尝试通过rails precompile:assets编译我的资产,但仍然没有效果。

谁能帮我这个?我是英雄库的初学者。

你的 Heroku 日志是这样说的:

#...
remote:        Uglifier::Error: Unexpected token: name (newOption). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
#...

Joel_Blum评论中已经提到它,请尝试替换

config.assets.js_compressor = :uglifier

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

config/environments/production.rb

请参阅 https://github.com/lautis/uglifier/issues/127#issuecomment-352224986

最新更新