aws beanstalk for sinatra app - Could not find 'bundler' (2.0.2) required by your /var/app/ondeck/Gemfile.lock

306 Views Asked by At

Summary: how to I get beanstalk to use bundler 2 when my attempts failed

Trying to deploy a Sinatra app using Elastic Beanstalk

I get (logs)

  ...
  + cat Gemfile
  source 'https://rubygems.org'
  
  gem 'sinatra'
  gem 'aws-sdk-s3'
  + '[' -d /var/app/ondeck/vendor/cache ']'
  + bundle install
  /opt/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems.rb:284:in `find_spec_for_exe': Could not find 'bundler' (2.0.2) required by your /var/app/ondeck/Gemfile.lock. (Gem::GemNotFoundException)
  To update to the latest version installed on your system, run `bundle update --bundler`.
  To install the missing version, run `gem install bundler:2.0.2`
    from /opt/rubies/ruby-2.6.5/lib/ruby/site_ruby/2.6.0/rubygems.rb:303:in `activate_bin_path'
    from /opt/rubies/ruby-2.6.5/bin/bundle:23:in `<main>' (Executor::NonZeroExitStatus)

I tried changing config.ru and adding

require './app.rb'
gem install bundler:2.0.2  # <-- added this
bundle update --bundler    # <-- added this
bundle                     # <-- added this
run Sinatra::Application

but that did not help - did not seem to change behavior.

Is config.ru even the right file to change? With or without my bundle command it tries bundle anyway it seems.

I tried removing my Gemfile.lock file from the bundle and this worked.
However I would like to know how I could avoid that every time and without reverting my local system to old bundler 1. In other words how to I get beanstalk to use bundler 2 when my attempts failed.

0

There are 0 best solutions below