我是Ruby新手,过去在我的Linux虚拟机上安装了几个gem。然而,当我尝试安装任何新的gem时,我得到:Gem::Requirement::BadRequirementError
以下是我尝试使用此命令安装google-api-client gem时的整个错误消息:
gem install -v google-api-client
ERROR: While executing gem ... (Gem::Requirement::BadRequirementError)
Illformed requirement ["google-api-client"]
raise BadRequirementError, "Illformed requirement [#{obj.inspect}]"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/requirement.rb:106:in `parse'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/requirement.rb:138:in `block in initialize'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/requirement.rb:138:in `map!'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/requirement.rb:138:in `initialize'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/version_option.rb:55:in `new'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/version_option.rb:55:in `block in add_version_option'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/optparse/lib/optparse.rb:583:in `conv_arg'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/optparse/lib/optparse.rb:738:in `parse'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1686:in `block in parse_in_order'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1636:in `catch'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1636:in `parse_in_order'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1630:in `order!'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1739:in `permute!'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/optparse/lib/optparse.rb:1764:in `parse!'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/command.rb:448:in `handle_options'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/command.rb:313:in `invoke_with_build_args'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/command_manager.rb:252:in `invoke_command'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/command_manager.rb:192:in `process_args'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/command_manager.rb:150:in `run'
/home/blainefreestone/.rbenv/versions/3.2.2/lib/ruby/3.2.0/rubygems/gem_runner.rb:51:in `run'
/home/blainefreestone/.rbenv/versions/3.2.2/bin/gem:10:in `<main>'
我研究了这个问题,但每个答案都与特定宝石中的一个问题有关。这对我尝试安装的每个gem都是一样的。
1条答案
按热度按时间sshcrbum1#
-v
选项用于安装特定版本的gem。例如,像这样:但是您的CLI调用丢失了一个版本号,因此您会收到该错误消息。
当你只想安装最新版本的gem时,删除
-v
部分,然后像这样安装gem: