无法更新Gemfile

时间:2018-12-07 04:37:42

标签: ruby heroku heroku-toolbelt

我将Heroku托管的ROR应用程序从Ruby 1.9.3升级到2.3.1p112

我在Heroku控制台上收到此错误

remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     Detected a mismatch between your Ruby version installed and
remote:  !     Ruby version specified in Gemfile or Gemfile.lock. You can
remote:  !     correct this by running:
remote:  !     
remote:  !     $ bundle update --ruby
remote:  !     $ git add Gemfile.lock
remote:  !     $ git commit -m "update ruby version"
remote:  !     
remote:  !     If this does not solve the issue please see this documentation:
remote:  !     
remote:  !     https://devcenter.heroku.com/articles/ruby-versions#your-ruby-version-is-x-but-your-gemfile-specified-y

所以我做到了,而且不确定如何解决? 2.3.1在哪里设置?如果我将Gemfile设置为2.3.1而不是2.3.1p112,则推送到Heroku失败,并且出现上述错误?

 MacBook-Pro-2:treesy-api me$ bundle platform --ruby
ruby 2.3.1p112
MacBook-Pro-2:treesy-api me$ bundler -v
Bundler version 1.17.1
MacBook-Pro-2:treesy-api me$ cat Gemfile.lock | grep -A 2 RUBY
RUBY VERSION
   ruby 2.3.1p112

MacBook-Pro-2:treesy-api me$ bundle update --ruby
Your Ruby version is 2.3.1, but your Gemfile specified 2.3.1p112
MacBook-Pro-2:treesy-api me$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin17]s

1 个答案:

答案 0 :(得分:1)

只需使用

ruby '~> 2.5.1'

在您的Gemfile

2.5.1

在您的.ruby-version