-
`find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /var/app/ondeck/Gemfile.lockDev/AWS Elastifc Beanstalk 2020. 2. 22. 14:29반응형
Elastic Beanstalk 에 Rails application 을 디플로이하면 아래와 같은 에러 때문에 디플로이가 안될 때가 있다.
/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.1.4) 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.1.4` 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>'.
Elastic Beanstalk Ruby instance 에서 기본 사용하는 bundler 가 실행하려는 ruby application 이 필요로하는 bundler 버전과 맞지 않아서 발생하는 문제다.
.ebextensions/gem_install_bundler.config 스크립트를 아래와 같이 생성한 후 다시 디플로이한다.
commands: update_bundler: command: /opt/rubies/ruby-2.6.5/bin/gem install bundler -v 2.1.4 files: # Runs before `./10_bundle_install.sh`: "/opt/elasticbeanstalk/hooks/appdeploy/pre/09_gem_install_bundler.sh" : mode: "000775" owner: root group: users content: | #!/usr/bin/env bash EB_APP_STAGING_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k app_staging_dir) EB_SCRIPT_DIR=$(/opt/elasticbeanstalk/bin/get-config container -k script_dir) # Source the application's ruby, i.e. 2.6. Otherwise it will be 2.3, which will give this error: `bundler requires Ruby version >= 2.3.0` . $EB_SCRIPT_DIR/use-app-ruby.sh cd $EB_APP_STAGING_DIR echo "Installing compatible bundler" gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)" gem update --system
반응형