即使更改了Gemfile,由于不支持的Ruby版本,推送到Heroku也会失败

时间:2019-03-22 09:48:13

标签: ruby-on-rails ruby heroku rubygems

我正在尝试将一个分叉的仓库推送给Heroku,但是Heroku不接受推送,因为不接受Ruby 2.3.1。我在Gemfile中将版本更改为2.3.3并运行bundle install --without production,但奇怪的是它仍然被认为是2.3.1。即使尝试使用其他Ruby版本(如2.4.0),也发生了相同的事情。

参考:

$ cat Gemfile.lock | grep -A 2 RUBY
RUBY VERSION
ruby 2.3.3p222
$ bundle platform --ruby
ruby 2.3.3p222

错误:

remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote:        Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.3.1.tgz -s -o - | tar zxf - ' failed on attempt 1 of 3.
remote:        Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.3.1.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3.
remote:
remote:  !
remote:  !     An error occurred while installing ruby-2.3.1
remote:  !
remote:  !     This version of Ruby is not available on Heroku-18. The minimum supported version
remote:  !     of Ruby on the Heroku-18 stack can found at:
remote:  !
remote:  !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed

宝石文件:

# -*- mode: ruby; -*-
source 'https://rubygems.org'
ruby '2.3.3'

# basic app components
gem 'pg', '~> 0.21'
gem 'apartment', '>= 2.1.0'     # multi-tenancy: see README.md
gem 'rails', '4.2.9'
gem 'rack-timeout'              # prevent Heroku dynos from hanging up on timeout

gem 'where-or'                  # backport from Rails 5; remove when upgrading

gem 'builder'
gem 'bundler'
gem 'figaro'
gem 'sslrequirement'
gem 'haml'
gem 'gibbon'
gem 'i18n'
gem 'jbuilder', '~> 2.0'
gem 'jquery-rails', '= 4.0.5'
gem 'jquery-ui-rails', '= 5.0.5'
gem 'nokogiri'
gem 'pothoven-attachment_fu'
gem 'protected_attributes'      # remove once we migrate to Strong Parameters
gem 'responders', '~> 2.0'
gem 'attr_encrypted'            # attr_encrypted must load AFTER protected_attributes (https://github.com/attr-encrypted/attr_encrypted/issues/107)
gem 'rake'
gem 'stripe'
gem 'will_paginate'

# asset pipeline
gem 'sprockets-rails', :require => 'sprockets/railtie'
gem 'uglifier'
gem 'sassc-rails'

group :production do
  gem 'newrelic_rpm'
  gem 'puma-heroku'
  gem 'puma'
  gem 'rails_12factor'
end

group :test do
  gem 'cucumber', '~> 2.0'
  gem 'cucumber-rails', '1.5.0', :require => false
  gem 'capybara'
  gem 'fake_stripe'
  gem 'poltergeist'
  gem 'rspec-its'
  gem 'rspec-html-matchers'
  gem 'simplecov', :require => false
  gem 'spring'                  # for 'guard'
  gem 'webmock'
  gem 'vcr'
end

group :development do
  gem 'derailed_benchmarks'
  # gem 'query_trail'
  gem 'ruby-prof'
  gem 'stackprof'
  gem 'web-console', '~> 2.0'
  gem 'spring-commands-rspec'   # for use with Guard
end

group :development, :test do
  # the following really belong in a separate 'staging' environment
  gem 'faker', :git => 'https://github.com/armandofox/faker' # needed in production too,for adding fake data to staging server
  gem 'factory_bot_rails'                                    # used by fake_data stuff

  gem 'bullet'
  # cucumber and capybara
  gem 'yaml_db', :git => 'https://github.com/armandofox/yaml_db'
  gem 'byebug'                  # 4
  gem 'pry'
  gem 'listen', '~> 2.2'
  gem 'guard-rspec', :require => false
  gem 'guard-cucumber'
  gem 'minitest'
  gem 'faye-websocket'
  gem 'database_cleaner'
  gem 'rb-readline'
  gem 'rubyzip'
  gem 'mime-types'
  gem 'chronic'
  gem 'fakeweb'
  gem 'launchy'
  gem 'rack-test'
  gem 'sdoc', '~> 0.4.0'
  gem 'coveralls', :require => false
  gem 'rspec-rails'
  gem 'rspec-collection_matchers' # should have(n).items, etc
  gem 'rspec-activemodel-mocks'   # mock_model(Customer), etc
  gem 'sqlite3'
  gem 'timecop'
  gem 'traceroute'
end

1 个答案:

答案 0 :(得分:1)

Heroku不支持Ruby 2.3.1、2.3.3或2.4.0

查看您的日志:

remote:  !     An error occurred while installing ruby-2.3.1
remote:  !
remote:  !     This version of Ruby is not available on Heroku-18. The minimum supported version
remote:  !     of Ruby on the Heroku-18 stack can found at:
remote:  !
remote:  !     https://devcenter.heroku.com/articles/ruby-support#supported-runtimes

看看link from your log

  

Heroku支持以下Ruby版本和关联的Rubygems。受支持的版本意味着您可以期望我们的工具和平台可以与给定的版本一起使用。这也意味着您可以获得技术支持。这是我们支持的Ruby版本:

     

MRI:

     
      
  • 2.4.5:补丁程序级别335,Rubygems:2.6.14.4
  •   
  • 2.5.5:补丁程序级别157,Rubygems:2.7.6.2
  •   
  • 2.6.2:补丁程序级别33,Rubygems:3.0.3
  •   

还读取了信息how to specify Ruby version

请特别注意Troubleshooting部分。看起来您在更改Ruby版本之后并在推送到Heroku之前没有提交GemfileGemfile.lock