ruby - 无法更新 Gemfile
问题描述
我正在将 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,那么 Pushing to 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
解决方案
只需使用
ruby '~> 2.5.1'
在你Gemfile
和
2.5.1
在你的.ruby-version
推荐阅读
- python - 如何在python中打开.mpg格式的视频
- python - 是否可以使用 Python 在子文件夹中搜索 Excel 文件,然后列出文件中的所有工作簿和工作表?
- rust - 无法创建通用 JNIEnv,因为错误“线程 'main' 在 'Err' 值上调用 'Result::unwrap()' 时发生恐慌
- apple-developer - Apple 公证错误:“用户名不是提供商的成员”
- c++ - 使用列表进行动态结构分配
- javascript - 您如何使用 Apollo Client 有效地批处理 GraphQL 突变?
- c# - OneNote api 失败,代码为 20258。 graphClient.Users[userPrincipalName].Onenote.Pages.Request()
- javascript - JavaScript 代码适用于在 FireFox 中下载 csv,但不适用于 Microsoft Edge
- vim - 如何在 Vim 中对齐(以表格形式)行?
- c# - Outlook 未显示在呼叫者应用程序的顶部