本文介绍了安装Rails错误“invalid gem:package is corrupt”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在运行Mac OS X 10.9.1,我正在使用RVM来管理Ruby v2.0.0-p353。
I am running Mac OSX 10.9.1 and I am using RVM to manage Ruby v2.0.0-p353.
当我尝试安装Rails时,出现此错误:
When I try to install Rails I get this error:
Ryans-MacBook-Air-2:~ ryan$ gem install rails
ERROR: Error installing rails:
invalid gem: package is corrupt, exception while verifying: undefined method`path2class' for #<Psych::ClassLoader:0x0000010c9d0be0> (NoMethodError) in /Users/ryan/.rvm/gems/ruby-2.0.0-p353/cache/i18n-0.6.9.gem
以下是我已安装的宝石列表:
Here is a list of gems I have installed:
Ryans-MacBook-Air-2:~ ryan$ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.3, 1.2.0)
bundler (1.5.1)
bundler-unload (1.0.2)
executable-hooks (1.2.6)
gem-wrappers (1.2.1)
io-console (0.4.2)
json (1.8.1, 1.7.7)
minitest (5.2.0, 4.3.2)
psych (2.0.2, 2.0.0)
rake (10.1.1, 0.9.6)
rdoc (4.1.0, 4.0.0)
rubygems-bundler (1.4.2)
rvm (1.11.3.8)
test-unit (2.5.5, 2.0.0.0)
有没有人有解决此问题的建议?
Does anyone have suggestions to fix this?
推荐答案
最新版本不再有 class2path
可以通过将Psych gem降级到2.0.0来避免:
The latest version no longer has the class2path
method so the problem can be avoided by downgrading the Psych gem to version 2.0.0:
gem list psych # note down latest version
gem uninstall psych -v 2.0.5 # or whatever version you have installed
可以在需要时再次升级心灵宝石。
After the gems are installed you can upgrade the Psych gem again should you need it.
这篇关于安装Rails错误“invalid gem:package is corrupt”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!