我运行的是Mac OSX 10.9.1,我使用RVM来管理Rubyv2.0.0-p353。
当我尝试安装Rails时,我得到这个错误:
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下面是我安装的gem的列表:
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)有没有人有解决这个问题的建议?
发布于 2014-07-21 23:13:43
最新的版本不再有class2path方法,所以可以通过将method gem降级到2.0.0版本来避免这个问题:
gem list psych # note down latest version
gem uninstall psych -v 2.0.5 # or whatever version you have installed在安装了gem之后,如果需要的话,您可以再升级一次should gem。
发布于 2014-01-03 06:37:43
我和你一样,对环境也有同样的问题。我尝试了很多东西,包括Alexbhandari添加到评论中的链接。我花了几个小时,最后决定放弃,完全清除所有的~/.rvm文件夹,重新开始。
警告:这只适用于新安装,而不应该首先考虑您可能会丢失的东西,例如您可能自己构建的gemsets。但是,如果是新安装,您将不会丢失任何无法替换的内容。
我重命名了~/.rvm文件夹,这样我就有了一个备份,并重新开始了整个安装过程。这一次它起作用了,我实际上在大约20分钟内就启动并运行了,而不是之前我浪费了几个小时试图解决这个问题。
您可以在终端窗口中使用mv命令执行此操作。~/.rvm目录在我的$home目录中:
Stephens-MacBook-Pro-2:~ Steve$ mv .rvm old.rvm我知道这是一个极端的步骤,但是它在我的新安装上工作,所以我希望它能在未来帮助newby。
发布于 2014-04-13 07:46:18
我也遇到了同样的问题,我记得在我的终端输出中看到了一些东西,上面写着XCode开发人员工具已经过时或没有安装(我记不清是哪个了)。它建议运行:
$ xcode-select --install在这样做之后,我仍然遇到了问题。我尝试删除RVM的缓存(我使用的是RVM),但仍然收到错误。我还在使用ruby-2.0.0-p353。我做了以下几件事,现在一切都很顺利:
$ rvm get stable
$ rvm reload
$ rvm install 2.1
$ rvm gemset create your_gemset_name
# Updated my .ruby-version and .ruby-gemset files in my Rails app to use the new gemset
$ cd /to/my/rails/app
# You can run $ rvm list gemsets to make sure your app is now using the new gemset. It will point to the current one being used.
$ bundle install使用新版本的Ruby和新的gemset,一切都很好。不确定其他gem发生了什么,但当我尝试添加sidekiq gem并运行$ bundle install时,我首先注意到了这一点。
我想知道这是否与最近的XCode更新有关,因为有人问我关于开发人员工具的问题。
https://stackoverflow.com/questions/20850737
复制相似问题