提问者:小点点

如何修复"你的Ruby版本是2.5.3,但你的Gemfile指定2.5.1"部署AWSeb?


问题:我有问题部署应用程序AWSEB和每一个补救措施,我发现SO和谷歌没有帮助我的情况。

我安装了AWSEB命令行,并希望部署一个应用程序,我已经建立到那里,但我一直得到这个错误后,试图解决它:

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版本)

我已经做了:

  • 在Gemfile
  • 中设置ruby'2.5.3'
  • 捆绑包更新
  • 捆绑安装
  • gem安装捆绑器
  • gem更新捆绑器
  • 删除的gem锁文件和捆绑包更新d
  • ./bin/Spring停止(Spring未运行)

ruby-visruby 2.5.3p105(2018-10-18修订版65156)[x86_64-linux](这是本地的,我有rbenv全局设置为2.5.1,但我不相信这是一个问题,因为错误状态i是gefile)

我在更新或安装bundle后做了rbenv rehash

捆绑包更新--ruby

锁显示2.5.3

捆绑env显示:

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全局: 2.5.1
  • bundle exec this ruby: /home/bob/.rbenv/versions/2.5.3/bin/ruby

    rbenv版本:系统2.5.1

    2.5.3(由 /home/bob/Apps/uploader-master-side-3/.ruby-version设定)

    捆绑器-v:捆绑器版本1.17.2

    哪个ruby: /home/bob/.rbenv/shims/ruby

    rails c

    在进程5437中通过Spring预加载器运行加载开发环境(Rails 5.2.2)irb(main):001:0

    哪个gem: /home/bob/.rbenv/shims/gem

    -a gem: /home/bob/.rbenv/shims/gem /usr/bin/gem

    rbenv哪个包: /home/bob/.rbenv/versions/2.5.3/bin/bundle

    当我运行服务器时:

    => 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
    

    感谢您的时间和阅读这篇文章以及您的帮助!

    钉IN棺材:

    我只是拿了我在更新到新ruby之前创建的应用程序的副本并尝试部署它并得到这个:

    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之外的所有内容?我似乎没有选择和想法

    更新:

    我不知道AWSEB是基于我的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.
    

    由于这个错误与最初的问题不同,我在这里创建了一个新错误:使用AWWS部署EB但使用erors


  • 共1个答案

    匿名用户

    在将平台从Ruby 3.0 AmazonLinux2/3.4.4升级到Ruby 3.0 AmazonLinux2/3.4.6后,我遇到了这个问题,它升级了Ruby 3.0.3-

    我使用eb cli进行部署,eb部署,但解决问题的方法是通过直接在Elastic Beanstik控制台中上传AWSzip文件进行部署

    该zip文件是使用git Archive-v-omyapp.zip--format=zip HEAD生成AWS。

    我在这里回复是因为这是谷歌上的第一个SO链接,但这是帮助我的答案。