首页 > 解决方案 > 用于 sinatra 应用程序的 aws beanstalk - 找不到 /var/app/ondeck/Gemfile.lock 所需的“捆绑程序”(2.0.2)

问题描述

摘要:当我的尝试失败时,如何让 beanstalk 使用 bundler 2

尝试使用 Elastic Beanstalk 部署 Sinatra 应用程序

我得到(日志)

  ...
  + 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)

我尝试更改config.ru和添加

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

但这并没有帮助 - 似乎没有改变行为。

甚至是config.ru要更改的正确文件吗?不管有没有我的 bundle 命令,它似乎都会尝试 bundle 。

我尝试从包中删除我的 Gemfile.lock 文件,这很有效。
但是,我想知道如何每次都避免这种情况,并且无需将本地系统恢复为旧的捆绑器 1。换句话说,当我的尝试失败时,如何让 beanstalk 使用捆绑器 2。

标签: amazon-elastic-beanstalkbundlebundlergemfilegemfile.lock

解决方案


推荐阅读