安装 Rails 错误“无效的 gem:包已损坏"; [英] Install Rails Error "invalid gem: package is corrupt"

查看:27
本文介绍了安装 Rails 错误“无效的 gem:包已损坏";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行 Mac OSX 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

这是我安装的 gems 列表:

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

安装 gem 后,如果需要,您可以再次升级 Psych gem.

After the gems are installed you can upgrade the Psych gem again should you need it.

这篇关于安装 Rails 错误“无效的 gem:包已损坏";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆