简体   繁体   English

尝试运行gem命令时,运行RubyGems插件时出错

[英]Error running RubyGems plugin when trying to run the gem command

I'm getting this error when trying to run the gem command. 尝试运行gem命令时出现此错误。 Does anyone know what is causing this? 有谁知道是什么原因造成的? It's causing me to be not able to run rails g migration commands (I get a similar error), and I'd imagine probably a lot more. 这使我无法运行rails g migration命令(我收到类似的错误),并且我想可能还会更多。

Error loading RubyGems plugin "/Users/storwell/.rvm/gems/ruby-2.0.0-p247@global/gems/executable-hooks-1.2.2/lib/rubygems_plugin.rb": undefined method `stubs' for Gem::Specification:Class (NoMethodError)
/Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:255:in `matching_specs': undefined method `stubs' for Gem::Specification:Class (NoMethodError)
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:279:in `to_specs'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:309:in `to_spec'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems.rb:572:in `load_yaml'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:327:in `load_file'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:196:in `initialize'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:74:in `new'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:39:in `run'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/bin/gem:21:in `<main>'

Update: I've also tried the rake command and it throws the same error. 更新:我也尝试过rake命令,它会引发相同的错误。

I found an older link related to the same problem , and it seems that it might be either a (1) Ruby installation issue, or (2) RubyGem issue. 我发现了一个与相同问题相关的旧链接,看来它可能是(1)Ruby安装问题,还是(2)RubyGem问题。 If it a Ruby issue, you need to uninstall and reinstall Ruby by using RVM (Ruby Version Manager) it seems that it worked for some. 如果是Ruby问题,则需要使用RVM(Ruby版本管理器)卸载并重新安装Ruby,似乎它可以工作。 If it's (2) RubyGem issue (which it probably is), you either have to delete '/Users/storwell/.rvm/gems/ruby-2.0.0-p247@global/gems/executable-hooks-1.2.2/' folder or change the content in rubygems_plugin.rb file. 如果是(2)RubyGem问题(可能是),则必须删除'/Users/storwell/.rvm/gems/ruby-2.0.0-p247@global/gems/executable-hooks-1.2.2/ '文件夹或更改rubygems_plugin.rb文件中的内容。

One of the users suggested (you can find from the link): *"When I use "gem -v", the response will give me the error "Error loading RubyGems plugin "/Users/mercury/.rvm/gems/ruby-1.9.3-p194@global/gems/rubygems-bundler-0.2.8/lib/rubygems_plugin.rb": cannot load such file -- rubygems_bundler/rubygems_bundler_installer (LoadError) So I edit "rubygems_plugins.rb", and I change the require path of rubygems_bundler, the path after modified is "./rubygems_bundler/{file_name}", and the problem solved."* 建议的一位用户(您可以从链接中找到):*“当我使用” gem -v“时,响应将给我错误消息”错误加载RubyGems插件“ /Users/mercury/.rvm/gems/ruby- 1.9.3-p194@global/gems/rubygems-bundler-0.2.8/lib/rubygems_plugin.rb“:无法加载此类文件-rubygems_bundler / ruby​​gems_bundler_installer(LoadError)所以我编辑了“ ruby​​gems_plugins.rb”,并更改了需要rubygems_bundler的路径,修改后的路径为“ ./rubygems_bundler/{file_name}”,问题已解决。” *

I hope these instructions + link will help you to solve the problem. 希望这些说明+链接能帮助您解决问题。 I did go through the same tutorial book by Michael Hartl last summer. 去年夏天,我确实读过Michael Hartl的同一本教程书。 I think I have encountered a similar issue. 我想我也遇到过类似的问题。 I think I might have deleted one folder in order solve the issue, and perhaps reinstalled something as well (but I am not 100% because it has been a while) . 我想我可能已经删除了一个文件夹以解决该问题,并且可能还重新安装了一些文件夹(但我不是100%,因为已经有一段时间了)。

Try calling 尝试致电

$gem update --system $ gem更新-系统

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

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