在Heroku上降级/恢复Ruby版本

时间:2017-02-12 04:30:11

标签: ruby-on-rails ruby heroku

我最近将我的Heroku应用程序从Ruby 2.3.1更新为2.4.0,但我现在需要恢复到版本2.3.1

更新:

我将Gemfile中的版本从2.3.1更改为2.4.0。一切都很顺利,但我需要回到2.3.1,因为我2.4.0

特有的问题

要还原:

我已尝试将版本更改回2.3.1中的Gemfileruby "2.3.1"},但它只会引发捆绑错误Your Ruby version is 2.4.0, but your Gemfile specified 2.3.1

如何在Heroku上将我的Ruby版本更改回2.3.1

以下是部署错误:

ID yupp
-----> heroku-buildpack-rgeo-prep app detected
-----> Removing cached .bundle/config
       Writing new .bundle/config
-----> VendorBinaries app detected
-----> Found a .vendor_urls file
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.4.0
###### WARNING:
       You have the `.bundle/config` file checked into your repository
       It contains local state like the location of the installed bundle
       as well as configured git local gems, and other settings that should
       not be shared between multiple checkouts of a single repo. Please
       remove the `.bundle/` folder from your repo and add it to your `.gitignore` file.
       https://devcenter.heroku.com/articles/bundler-configuration
-----> Installing dependencies using bundler 1.13.7
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Warning: the running version of Bundler (1.13.7) is older than the version that created the lockfile (1.14.3). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
       Your Ruby version is 2.4.0, but your Gemfile specified 2.3.1
       Bundler Output: Warning: the running version of Bundler (1.13.7) is older than the version that created the lockfile (1.14.3). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
       Your Ruby version is 2.4.0, but your Gemfile specified 2.3.1
 !
 !     Failed to install gems via Bundler.
 !     Detected a mismatch between your Ruby version installed and
 !     Ruby version specified in Gemfile or Gemfile.lock:
 !     https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

1 个答案:

答案 0 :(得分:1)

我明白了。以下是步骤

当地:

将Ruby版本从2.4.0更改为2.3.1

使用2.3.1

验证版本为ruby -v

运行gem install bundler&& gem install rails

运行bundle install

提交GemfileGemfile.lock并推送到Heroku

相关问题