简体   繁体   English

Rails App rails 上的 Ruby 无法推送到 heroku; webpacker 错误

[英]Ruby on Rails App rails fails to push to heroku; webpacker error

  1. I am unable to push my Ruby on rails app to Heroku.我无法将我的 Ruby on rails 应用程序推送到 Heroku。 I encounter errors using the heoku-20 stack.我在使用 heoku-20 堆栈时遇到错误。

project versions:项目版本:

Ruby: ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
Rails: 6.1.3
Webpacker: 5.2.1
Node: v10.24.0
Yarn: 1.22.5
@rails/webpacker: 
ipos@0.1.0 /home/ubuntu/environment/ipos
└── @rails/webpacker@5.2.1 
Is bin/webpack present?: true
Is bin/webpack-dev-server present?: true
Is bin/yarn present?: true

I get errors listed below when attempting to deploy:尝试部署时出现下面列出的错误:

ubuntu:~/environment/ipos (main) $ git push heroku main
Counting objects: 31772, done.
Compressing objects: 100% (15426/15426), done.
Writing objects: 100% (31772/31772), 36.47 MiB | 34.45 MiB/s, done.
Total 31772 (delta 15360), reused 31767 (delta 15359)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Building on the Heroku-20 stack
remote: -----> Using buildpacks:
remote:        1. https://github.com/heroku/heroku-buildpack-ruby#v217
remote:        2. heroku/nodejs
remote:        3. heroku/ruby
remote: -----> Ruby app detected
remote: -----> Installing bundler 1.17.3
remote: -----> Removing BUNDLED WITH version in the Gemfile.lock
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.6.6
remote: -----> Installing dependencies using bundler 1.17.3
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        Your Gemfile lists the gem pg (>= 0) more than once.
remote:        You should probably keep only one of them.
remote:        Remove any duplicate entries and specify the gem only once (per group).
remote:        While it's not a problem now, it could cause errors if you change the version of one of them later.
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.3
remote:        Installing rake 13.0.3
remote:        Fetching concurrent-ruby 1.1.8
remote:        Fetching minitest 5.14.4
remote:        Fetching zeitwerk 2.4.2
remote:        Installing zeitwerk 2.4.2
remote:        Installing minitest 5.14.4
remote:        Installing concurrent-ruby 1.1.8
remote:        Fetching builder 3.2.4
remote:        Installing builder 3.2.4
remote:        Fetching erubi 1.10.0
remote:        Installing erubi 1.10.0
remote:        Fetching mini_portile2 2.5.0
remote:        Fetching racc 1.5.2
remote:        Installing mini_portile2 2.5.0
remote:        Installing racc 1.5.2 with native extensions
remote:        Fetching crass 1.0.6
remote:        Installing crass 1.0.6
remote:        Fetching rack 2.2.3
remote:        Installing rack 2.2.3
remote:        Fetching nio4r 2.5.5
remote:        Installing nio4r 2.5.5 with native extensions
remote:        Fetching websocket-extensions 0.1.5
remote:        Installing websocket-extensions 0.1.5
remote:        Fetching mimemagic 0.3.5
remote:        Installing mimemagic 0.3.5
remote:        Fetching mini_mime 1.0.2
remote:        Installing mini_mime 1.0.2
remote:        Fetching bcrypt 3.1.16
remote:        Installing bcrypt 3.1.16 with native extensions
remote:        Fetching msgpack 1.4.2
remote:        Installing msgpack 1.4.2 with native extensions
remote:        Using bundler 1.17.3
remote:        Fetching cancan 1.6.10
remote:        Installing cancan 1.6.10
remote:        Fetching method_source 1.0.0
remote:        Installing method_source 1.0.0
remote:        Fetching thor 1.1.0
remote:        Installing thor 1.1.0
remote:        Fetching ffi 1.14.2
remote:        Installing ffi 1.14.2 with native extensions
remote:        Fetching pg 1.2.3
remote:        Installing pg 1.2.3 with native extensions
remote:        Fetching tilt 2.0.10
remote:        Installing tilt 2.0.10
remote:        Fetching semantic_range 2.3.1
remote:        Installing semantic_range 2.3.1
remote:        Fetching turbolinks-source 5.2.0
remote:        Installing turbolinks-source 5.2.0
remote:        Fetching i18n 1.8.9
remote:        Installing i18n 1.8.9
remote:        Fetching tzinfo 2.0.4
remote:        Installing tzinfo 2.0.4
remote:        Fetching rack-test 1.1.0
remote:        Installing rack-test 1.1.0
remote:        Fetching sprockets 4.0.2
remote:        Installing sprockets 4.0.2
remote:        Fetching rack-proxy 0.6.5
remote:        Installing rack-proxy 0.6.5
remote:        Fetching websocket-driver 0.7.3
remote:        Installing websocket-driver 0.7.3 with native extensions
remote:        Fetching marcel 0.3.3
remote:        Installing marcel 0.3.3
remote:        Fetching mail 2.7.1
remote:        Installing mail 2.7.1
remote:        Fetching nokogiri 1.11.1 (x86_64-linux)
remote:        Installing nokogiri 1.11.1 (x86_64-linux)
remote:        Fetching puma 5.2.1
remote:        Installing puma 5.2.1 with native extensions
remote:        Fetching figaro 1.2.0
remote:        Installing figaro 1.2.0
remote:        Fetching bootsnap 1.7.2
remote:        Installing bootsnap 1.7.2 with native extensions
remote:        Fetching turbolinks 5.2.1
remote:        Installing turbolinks 5.2.1
remote:        Fetching activesupport 6.1.3
remote:        Installing activesupport 6.1.3
remote:        Fetching sassc 2.4.0
remote:        Installing sassc 2.4.0 with native extensions
remote:        Fetching loofah 2.9.0
remote:        Installing loofah 2.9.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 6.1.3
remote:        Installing activemodel 6.1.3
remote:        Fetching jbuilder 2.11.2
remote:        Installing jbuilder 2.11.2
remote:        Fetching rails-html-sanitizer 1.3.0
remote:        Installing rails-html-sanitizer 1.3.0
remote:        Fetching activejob 6.1.3
remote:        Installing activejob 6.1.3
remote:        Fetching activerecord 6.1.3
remote:        Installing activerecord 6.1.3
remote:        Fetching email_validator 1.6.0
remote:        Installing email_validator 1.6.0
remote:        Fetching actionview 6.1.3
remote:        Installing actionview 6.1.3
remote:        Fetching actionpack 6.1.3
remote:        Installing actionpack 6.1.3
remote:        Fetching activestorage 6.1.3
remote:        Fetching actioncable 6.1.3
remote:        Installing activestorage 6.1.3
remote:        Installing actioncable 6.1.3
remote:        Fetching actionmailer 6.1.3
remote:        Installing actionmailer 6.1.3
remote:        Fetching railties 6.1.3
remote:        Installing railties 6.1.3
remote:        Fetching sprockets-rails 3.2.2
remote:        Installing sprockets-rails 3.2.2
remote:        Fetching actionmailbox 6.1.3
remote:        Installing actionmailbox 6.1.3
remote:        Fetching actiontext 6.1.3
remote:        Installing actiontext 6.1.3
remote:        Fetching rails 6.1.3
remote:        Fetching webpacker 5.2.1
remote:        Installing rails 6.1.3
remote:        Installing webpacker 5.2.1
remote:        Fetching clearance 1.15.1
remote:        Installing clearance 1.15.1
remote:        Fetching sassc-rails 2.1.2
remote:        Installing sassc-rails 2.1.2
remote:        Fetching sass-rails 6.0.0
remote:        Installing sass-rails 6.0.0
remote:        Bundle complete! 27 Gemfile dependencies, 63 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into `./vendor/bundle`
remote:        Bundle completed (260.60s)
remote:        Cleaning up the bundler cache.
remote:        Your Gemfile lists the gem pg (>= 0) more than once.
remote:        You should probably keep only one of them.
remote:        Remove any duplicate entries and specify the gem only once (per group).
remote:        While it's not a problem now, it could cause errors if you change the version of one of them later.
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: -----> Installing node-v10.15.3-linux-x64
remote: -----> Installing yarn-v1.16.0
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        yarn install v1.16.0
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        error @rails/webpacker@5.2.1: The engine "node" is incompatible with this module. Expected version ">=10.17.0". Got "10.15.3"
remote:        error Found incompatible module.
remote:        info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
remote:        rake aborted!
remote:        Sprockets::FileNotFound: couldn't find file 'trix/dist/trix' with type 'text/css'
remote:        Checked in these paths: 
remote:          /tmp/build_8fc01f26/app/assets/config
remote:          /tmp/build_8fc01f26/app/assets/images
remote:          /tmp/build_8fc01f26/app/assets/stylesheets
remote:          /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/actioncable-6.1.3/app/assets/javascripts
remote:          /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/activestorage-6.1.3/app/assets/javascripts
remote:          /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/actionview-6.1.3/lib/assets/compiled
remote:          /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/turbolinks-source-5.2.0/lib/assets/javascripts
remote:          /tmp/build_8fc01f26/node_modules
remote:        /tmp/build_8fc01f26/app/assets/stylesheets/actiontext.scss:6
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/resolve.rb:62:in `resolve!'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:409:in `resolve'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:216:in `process_require_directive'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:189:in `block in process_directives'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:187:in `each'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:187:in `process_directives'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:84:in `_call'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:65:in `call'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:182:in `load_from_unloaded'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:59:in `block in load'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:43:in `load'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/cached_environment.rb:44:in `load'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/bundle.rb:27:in `call'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:182:in `load_from_unloaded'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:59:in `block in load'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:43:in `load'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/cached_environment.rb:44:in `load'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/bundle.rb:32:in `block in call'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/bundle.rb:31:in `call'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:182:in `load_from_unloaded'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:59:in `block in load'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:43:in `load'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/cached_environment.rb:44:in `load'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/base.rb:81:in `find_asset'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/base.rb:88:in `find_all_linked_assets'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/manifest.rb:125:in `block (2 levels) in find'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `block in synchronize'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `synchronize'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:41:in `synchronize'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:19:in `execute'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/promise.rb:563:in `block in realize'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:363:in `run_task'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `block (3 levels) in create_worker'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `loop'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `block (2 levels) in create_worker'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `catch'
remote:        /tmp/build_8fc01f26/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.8/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block in create_worker'
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:  !
remote:  ! ## Warning - The same version of this code has already been built: 85e3e5a7b8fe7283987f26d235ba4fb37c08cd70
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 85e3e5a7b8fe7283987f26d235ba4fb37c08cd70
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote: 
remote: Verifying deploy...
remote: 
remote: !       Push rejected to nameless-bastion-29082.
remote: 
To https://git.heroku.com/nameless-bastion-29082.git
 ! [remote rejected]   main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/nameless-bastion-29082.git'
  1. Things I have tried (that did not work)我尝试过的事情(没有用)
heroku buildpacks:clear
heroku buildpacks:set heroku/nodejs
heroku buildpacks:add heroku/ruby
yarn install -ignore--engines

I am a student who is still learning ruby/rails.我是一名仍在学习 ruby/rails 的学生。 I would appreciate any and all help, thank you so much!我将不胜感激任何和所有的帮助,非常感谢!

If you scroll down the deploy errors from Heroku it says.. (In development you're going to have to read a lot of errors so get used to searching up terms and getting a complete understanding of what the errors are saying)如果您从 Heroku 向下滚动部署错误,它会说..(在开发中,您将不得不阅读很多错误,因此要习惯于搜索术语并全面了解错误的含义)

So it says所以它说

Running bundle install..
Your Gemfile lists the gem pg.. more than once.

So your Gemfile file is composed of the things that are used to install modules/gems when your app runs.因此,您的 Gemfile 文件由在您的应用程序运行时用于安装模块/宝石的东西组成。

You accidentally listed one of the modules twice (pg/postgres) just remove one of them and it should work.您不小心将其中一个模块列出了两次(pg/postgres),只需删除其中一个,它应该可以工作。

It also says它还说

@rails/webpacker@5.2.1: The engine "node" is incompatible. 

Expected version ">=10.17.0". Got "10.15.3"

Found incompatible module.

So try to change the webpack/webpacker version in Gemfile as well.所以尝试更改 Gemfile 中的 webpack/webpacker 版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM