Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
288 views
in Technique[技术] by (71.8m points)

ruby on rails - "Could not find 'bundler' (2.0.1) required by your Gemfile.lock" while deploying to Heroku

I am trying to deploy a simple Rails app to Heroku but keep getting several errors. I have searched the error

remote: ! Could not detect rake tasks

with little success so far. Here is the full build log:

Counting objects: 209, done.
Compressing objects: 100% (188/188), done.
Writing objects: 100% (209/209), 771.35 KiB | 10.71 MiB/s, done.
Total 209 (delta 58), reused 0 (delta 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: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.6.1
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 12.3.2
remote:        Installing rake 12.3.2
remote:        Fetching concurrent-ruby 1.1.5
remote:        Fetching minitest 5.11.3
remote:        Fetching thread_safe 0.3.6
remote:        Installing minitest 5.11.3
remote:        Installing thread_safe 0.3.6
remote:        Installing concurrent-ruby 1.1.5
remote:        Fetching builder 3.2.3
remote:        Installing builder 3.2.3
remote:        Fetching erubi 1.8.0
remote:        Installing erubi 1.8.0
remote:        Fetching crass 1.0.4
remote:        Fetching mini_portile2 2.4.0
remote:        Installing mini_portile2 2.4.0
remote:        Installing crass 1.0.4
remote:        Fetching rack 2.0.7
remote:        Fetching nio4r 2.4.0
remote:        Installing rack 2.0.7
remote:        Installing nio4r 2.4.0 with native extensions
remote:        Fetching websocket-extensions 0.1.4
remote:        Installing websocket-extensions 0.1.4
remote:        Fetching mini_mime 1.0.1
remote:        Installing mini_mime 1.0.1
remote:        Fetching arel 9.0.0
remote:        Installing arel 9.0.0
remote:        Fetching mimemagic 0.3.3
remote:        Fetching execjs 2.7.0
remote:        Installing mimemagic 0.3.3
remote:        Installing execjs 2.7.0
remote:        Fetching msgpack 1.3.0
remote:        Installing msgpack 1.3.0 with native extensions
remote:        Using bundler 2.0.2
remote:        Fetching coffee-script-source 1.12.2
remote:        Installing coffee-script-source 1.12.2
remote:        Fetching method_source 0.9.2
remote:        Installing method_source 0.9.2
remote:        Fetching thor 0.20.3
remote:        Installing thor 0.20.3
remote:        Fetching ffi 1.11.1
remote:        Installing ffi 1.11.1 with native extensions
remote:        Fetching pg 1.1.4
remote:        Installing pg 1.1.4 with native extensions
remote:        Fetching puma 3.12.1
remote:        Installing puma 3.12.1 with native extensions
remote:        Fetching rack-timeout 0.3.2
remote:        Installing rack-timeout 0.3.2
remote:        Fetching rb-fsevent 0.10.3
remote:        Installing rb-fsevent 0.10.3
remote:        Fetching tilt 2.0.9
remote:        Installing tilt 2.0.9
remote:        Fetching turbolinks-source 5.2.0
remote:        Installing turbolinks-source 5.2.0
remote:        Fetching tzinfo 1.2.5
remote:        Installing tzinfo 1.2.5
remote:        Fetching nokogiri 1.10.3
remote:        Installing nokogiri 1.10.3 with native extensions
remote:        Fetching i18n 1.6.0
remote:        Installing i18n 1.6.0
remote:        Fetching websocket-driver 0.7.1
remote:        Installing websocket-driver 0.7.1 with native extensions
remote:        Fetching mail 2.7.1
remote:        Installing mail 2.7.1
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 autoprefixer-rails 9.6.1
remote:        Installing autoprefixer-rails 9.6.1
remote:        Fetching uglifier 4.1.20
remote:        Installing uglifier 4.1.20
remote:        Fetching marcel 0.3.3
remote:        Installing marcel 0.3.3
remote:        Fetching coffee-script 2.4.1
remote:        Installing coffee-script 2.4.1
remote:        Fetching bootsnap 1.4.4
remote:        Installing bootsnap 1.4.4 with native extensions
remote:        Fetching rb-inotify 0.10.0
remote:        Installing rb-inotify 0.10.0
remote:        Fetching turbolinks 5.2.0
remote:        Installing turbolinks 5.2.0
remote:        Fetching activesupport 5.2.3
remote:        Installing activesupport 5.2.3
remote:        Fetching materialize-sass 1.0.0
remote:        Installing materialize-sass 1.0.0
remote:        Fetching loofah 2.2.3
remote:        Installing loofah 2.2.3
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:        Fetching activemodel 5.2.3
remote:        Fetching jbuilder 2.9.1
remote:        Installing globalid 0.4.2
remote:        Installing jbuilder 2.9.1
remote:        Installing activemodel 5.2.3
remote:        Fetching rails-html-sanitizer 1.0.4
remote:        Installing rails-html-sanitizer 1.0.4
remote:        Fetching sass 3.7.4
remote:        Fetching activejob 5.2.3
remote:        Installing activejob 5.2.3
remote:        Installing sass 3.7.4
remote:        Fetching actionview 5.2.3
remote:        Fetching activerecord 5.2.3
remote:        Installing actionview 5.2.3
remote:        Installing activerecord 5.2.3
remote:        Fetching actionpack 5.2.3
remote:        Installing actionpack 5.2.3
remote:        Fetching actioncable 5.2.3
remote:        Fetching actionmailer 5.2.3
remote:        Fetching activestorage 5.2.3
remote:        Installing actionmailer 5.2.3
remote:        Installing activestorage 5.2.3
remote:        Installing actioncable 5.2.3
remote:        Fetching railties 5.2.3
remote:        Installing railties 5.2.3
remote:        Fetching sprockets-rails 3.2.1
remote:        Installing sprockets-rails 3.2.1
remote:        Fetching coffee-rails 4.2.2
remote:        Fetching material_icons 2.2.1
remote:        Fetching rails 5.2.3
remote:        Installing coffee-rails 4.2.2
remote:        Installing rails 5.2.3
remote:        Fetching sass-rails 5.0.7
remote:        Installing material_icons 2.2.1
remote:        Installing sass-rails 5.0.7
remote:        Bundle complete! 21 Gemfile dependencies, 64 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:        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:        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 (50.71s)
remote:        Cleaning up the bundler cache.
remote: -----> Installing node-v10.15.3-linux-x64
remote:        Detected manifest file, assuming assets were compiled locally
remote: -----> Detecting rails configuration
remote: -----> Detecting rake tasks
remote: 
remote:  !
remote:  !     Could not detect rake tasks
remote:  !     ensure you can run `$ bundle exec rake -P` against your app
remote:  !     and using the production group of your Gemfile.
remote:  !     Activating bundler (2.0.1) failed:
remote:  !     Could not find 'bundler' (2.0.1) required by your /tmp/build_0f1ee1123a51e110b42092350be4440a/Gemfile.lock.
remote:  !     To update to the latest version installed on your system, run `bundle update --bundler`.
remote:  !     To install the missing version, run `gem install bundler:2.0.1`
remote:  !     Checked in 'GEM_PATH=/tmp/build_0f1ee1123a51e110b42092350be4440a/vendor/bundle/ruby/2.6.0', execute `gem env` for more information
remote:  !     
remote:  !     To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote:  !
remote: /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/rake_runner.rb:106:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)
remote: ensure you can run `$ bundle exec rake -P` against your app
remote: and using the production group of your Gemfile.
remote: Activating bundler (2.0.1) failed:
remote: Could not find 'bundler' (2.0.1) required by your /tmp/build_0f1ee1123a51e110b42092350be4440a/Gemfile.lock.
remote: To update to the latest version installed on your system, run `bundle update --bundler`.
remote: To install the missing version, run `gem install bundler:2.0.1`
remote: Checked in 'GEM_PATH=/tmp/build_0f1ee1123a51e110b42092350be4440a/vendor/bundle/ruby/2.6.0', execute `gem env` for more information
remote: 
remote: To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/ruby.rb:866:in `rake'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails2.rb:79:in `has_jobs_work_task?'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/rails2.rb:53:in `block in default_process_types'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/instrument.rb:18:in `block (2 levels) in instrument'
remote:     from /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The documentation lists a number of issues with Bundler 2. It looks like you are using Ruby 2.6.1, which means that you are affected by

A Gemfile.lock that specifies bundler 2.0.2 does not work with bundler 2.0.1

If you attempt to deploy an app that uses bundler 2.0.2 onto the Heroku platform with bundler 2.0.1 you may get this error:

`find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)

This is due to a bug in the Rubygems bundler version checking code. To avoid this issue, upgrade your Ruby version. It is fixed in 2.5.5+ and 2.6.3+. If you do not update, your Ruby version then every new release of Bundler 2.x will trigger this issue.

Upgrade your Ruby to 2.6.3 or later, change the ruby version in your Gemfile accordingly, re-run bundle install locally, and then redeploy.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...