问题:我在将应用程序部署到AWS EB时遇到问题,在SO和google上找到的所有补救措施都无济于事。
我安装了AWS EB命令行,并希望将自己构建的应用程序部署到那里,但是尝试解决该错误后,我仍然收到此错误:
ERROR [Instance: i-065ec77b2c530362b] Command failed on instance. Return code: 18 Output: (TRUNCATED)...g: the running version of Bundler (1.16.2) is older than the version that created the lockfile (1.17.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
Your Ruby version is 2.5.3, but your Gemfile specified 2.5.1.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2018-12-21 08:51:28 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
该应用最初是用2.5.1构建的,但今天我将其切换到2.5.3,因此可以将其放到AWS上。 (我在rbenv中同时拥有这两个ruby版本)
我已经完成:
ruby '2.5.3'
bundle update
bundle install
gem install bundler
gem update bundler
bundle update
d ./bin/spring stop
(弹簧未运行) ruby -v
是ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
(这仅是本地的,我将rbenv全局设置为2.5.1,但我不认为这是个问题,因为错误指出我是gemfile)
更新或安装捆绑软件后,我已经完成rbenv rehash
bundle update --ruby
Gemfile.lock显示2.5.3
捆绑包环境显示:
RUBY VERSION
ruby 2.5.3p105
BUNDLED WITH
1.17.2
```
我的整个Gemfile-以防万一这可能会有所帮助:
gem 'dotenv-rails', groups: [:development, :test]
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.5.3'
gem 'rails', '~> 5.2.1'
gem 'stripe'
gem 'stripe_event'
gem 'pry'
# Use sqlite3 as the database for Active Record
# gem 'sqlite3'
gem 'pg'
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem "chartkick"
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
# gem 'redis', '~> 4.0'
gem 'api-pagination', '~> 4.1', '>= 4.1.1'
gem 'will_paginate', '~> 3.1', '>= 3.1.6'
gem 'groupdate'
gem 'blazer'
gem 'ahoy_matey'
gem 'devise'
gem 'cancancan', '~> 2.0'
gem 'carrierwave', '~> 1.0'
gem 'carrierwave-aws'
gem 'carrierwave-ffmpeg'
gem 'carrierwave-video'
gem 'bootstrap', '~> 4.1.3'
gem 'sprockets-rails', :require => 'sprockets/railtie'
gem 'sprockets'
gem 'jquery-rails'
gem 'mini_magick', '~> 4.8'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false
group :development, :test do
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
gem 'chromedriver-helper'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
更多信息:
rbenv local
:2.5.3 rbenv global
:2.5.1 bundle exec which ruby
:/home/bob/.rbenv/versions/2.5.3/bin/ruby
rbenv versions
:
系统
2.5.1
2.5.3(由/home/bob/Apps/uploader-master-side-3/.ruby-version设置)
bundler -v
:捆绑软件版本1.17.2
bundle platform --ruby
:红宝石2.5.3p105 which ruby
:/home/bob/.rbenv/shims/ruby
rails c
:
在过程5437中通过Spring预加载器运行 加载开发环境(Rails 5.2.2) irb(main):001:0>
which gem
:/home/bob/.rbenv/shims/gem
rbenv which gem
:/home/bob/.rbenv/versions/2.5.3/bin/gem which -a gem
:
/home/bob/.rbenv/shims/gem
/ usr / bin / gem
rbenv which bundle
:/home/bob/.rbenv/versions/2.5.3/bin/bundle
echo $PATH
:/ home / bob / .rbenv / plugins / ruby-build / bin:/home/bob/.rbenv/shims:/home/bob/.rbenv/bin:/ home / bob / .local / bin:/ usr / local / sbin:/ usr / local / bin:/ usr / sbin:/ usr / bin:/ sbin:/ bin:/ usr / games:/ usr / local / games:/ snap /箱ruby-build --version
:ruby-build 20181106-14-g1ec9abd 我运行服务器时:
=> Booting Puma
=> Rails 5.2.2 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.12.0 (ruby 2.5.3-p105), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop
感谢您的时间,阅读本文和您的帮助!
钉在棺材里
我只是拿了我创建的应用程序副本,然后将其更新为新的红宝石,并尝试对其进行部署并得到了它:
Your Ruby version is 2.5.3, but your Gemfile specified 2.5.1.
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/10_bundle_install.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2018-12-21 11:04:39 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
....这是在全球和本地设置的2.5.1
我还有什么其他选择?删除并重新安装rbenv?制作一个新应用并复制除gemfile以外的所有内容?我似乎没有选择和想法
更新:
我不知道AWS EB是基于我的git提交的,而且我在尝试之前从未对其进行过更新(哇),现在我没有收到ruby版本错误...
所以现在我没有收到版本错误,但是我确实收到了此错误:
2018-12-21 22:50:56 ERROR [Instance: i-00ae954ad2b716b2a] Command failed on instance. Return code: 1 Output: (TRUNCATED)...lizers/carrierwave.rb:1:in `<main>'
/var/app/ondeck/config/environment.rb:5:in `<main>'
/opt/rubies/ruby-2.5.3/bin/bundle:23:in `load'
/opt/rubies/ruby-2.5.3/bin/bundle:23:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace).
Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/11_asset_compilation.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2018-12-21 22:50:56 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2018-12-21 22:51:58 ERROR Create environment operation is complete, but with errors. For more information, see troubleshooting documentation.
由于此错误与原始问题不同,因此我在这里创建了一个新错误:Deploying with AWWS EB but with erors