简体   繁体   English

Gem::InstallError: minitest 需要 Ruby 版本 ~> 2.2

[英]Gem::InstallError: minitest requires Ruby version ~> 2.2

Currently I am getting following error while doing bundle install目前我在进行捆绑安装时遇到以下错误

Gem::InstallError: minitest requires Ruby version ~> 2.2

It is trying to install latest minitest gem version (ie 5.12.2 which is released on September 29, 2019)它正在尝试安装最新的 minitest gem 版本(即 2019 年 9 月 29 日发布的 5.12.2)

I checked my both Gemfile and Gemfile.lock files but I didn't found my traces of minitest gem.我检查了我的 Gemfile 和 Gemfile.lock 文件,但我没有找到 minitest gem 的痕迹。 So I am thinking it is a dependency gem.所以我认为它是一个依赖宝石。

I tried to do forcefully install its version to 4.7.5 which is previous version by defining in gem file as gem 'minitest', '4.7.5' But still it is trying to install version 5.12.2 .我试图通过在 gem 文件中定义为gem 'minitest', '4.7.5'来强制将其版本安装到以前的版本4.7.5但它仍在尝试安装版本5.12.2

System details:系统详情:

  • ruby 2.1.5p273 ruby 2.1.5p273
  • bundler (1.12.5)捆绑器 (1.12.5)
  • Rails 3.2.17导轨 3.2.17

So how can I fix this issue.那么我该如何解决这个问题。

EDIT编辑

After debugging I found that rspec-core has dependency of minitest.调试后发现 rspec-core 有 minitest 的依赖。

I just got this error when rebuilding the bundle of an old Rails program.我在重建旧 Rails 程序的包时遇到了这个错误。 I checked Gemfile and the gem wasn't there.我检查了Gemfile并且 gem 不存在。 I deleted Gemfile.lock and didn't get the error when I rebuilt the bundle.我删除Gemfile.lock并且在重建捆绑包时没有收到错误。

gem 'minitest', '~> 4.7.5'

Edit your Gemfile something like this.像这样编辑您的 Gemfile。 Make sure there are no minitest gems already installed, remove them if any.确保没有安装 minitest gem,如果有的话,删除它们。

gem list | grep minitest 

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

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