简体   繁体   English

在 Heroku 上降级/恢复 Ruby 版本

[英]Downgrade/Revert Ruby Version on Heroku

I recently updated my Heroku app from Ruby 2.3.1 to 2.4.0 , but I now need to revert back to version 2.3.1 .我最近将 Heroku 应用程序从 Ruby 2.3.1更新到2.4.0 ,但我现在需要恢复到版本2.3.1

To Update:更新:

I changed the version in the Gemfile from 2.3.1 to 2.4.0 .我将Gemfile的版本从2.3.1更改为2.4.0 Everything went fine, but I need to go back to 2.3.1 because of problems specific to me with 2.4.0一切顺利,但我需要回到2.3.1因为2.4.0特定问题

To Revert:还原:

I've tried changing the version back to 2.3.1 in my Gemfile (as ruby "2.3.1" ) but it just throws the bundler error Your Ruby version is 2.4.0, but your Gemfile specified 2.3.1我已经尝试在我的Gemfile中将版本改回2.3.1 (如ruby "2.3.1" ),但它只是抛出了bundler 错误Your Ruby version is 2.4.0, but your Gemfile specified 2.3.1

How do I change my Ruby version back to 2.3.1 on Heroku?如何在 Heroku 上将我的 Ruby 版本改回2.3.1

Here is the error on deployment:这是部署时的错误:

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

I figured it out.我想到了。 Here are the steps以下是步骤

Locally:本地:

Change the Ruby version from 2.4.0 to 2.3.1将 Ruby 版本从2.4.0更改为2.3.1

Verify the version is 2.3.1 with ruby -v使用ruby -v验证版本为2.3.1

Run gem install bundler && gem install rails运行gem install bundler && gem install rails

Run bundle install运行bundle install

Commit the Gemfile and Gemfile.lock and push to Heroku提交GemfileGemfile.lock并推送到 Heroku

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM