Gem::安装错误 [英] Gem::Install Error

查看:59
本文介绍了Gem::安装错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用 sudo gem cleanup rails

我收到以下错误:

Cleaning up installed gems...
Attempting to uninstall rails-2.3.5
Unable to uninstall rails-2.3.5:
Gem::InstallError: cannot uninstall, check `gem list -d rails`
Attempting to uninstall rails-1.2.6
Unable to uninstall rails-1.2.6:
Gem::InstallError: cannot uninstall, check `gem list -d rails`

gem list -d rails 结果:

rails (2.3.8, 2.3.5, 1.2.6)
  Author: David Heinemeier Hansson
  Rubyforge: http://rubyforge.org/projects/rails
  Homepage: http://www.rubyonrails.org
  Installed at (2.3.8): /Library/Ruby/Gems/1.8
               (2.3.5): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
               (1.2.6): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

  Web-application framework with template engine, control-flow layer,
  and ORM.

有人知道怎么回事吗?

推荐答案

经过长时间的搜索,结果是因为路径不存在.由于系统没有搜索/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

After some long searches it turns out the reason is because of a non-existent path. The cannot uninstall comes up because the system doesn't search /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

在粒度级别上,您可以简单地使用卸载命令并输入:

On a granular level, instead of gem cleanup rails, you can simply use the uninstall command and type:

gem uninstall rails -i/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

然后您可能会遇到与不存在的路径相关的另一个问题,此时您应该使用以下命令创建一个目录:

Then you might hit another problem related to a non-existent path, at which point, you should create a directory using the command:

mkdir/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/bin

现在所有卸载都应该运行良好.我建议通过执行以下功能来重新安装干净的 gem:

Now all uninstalls should work well. I recommend doing a clean gem reinstall by performing the following functions:

gem list --no-versions |sed -e '/^(*|$)/d' >installed_gems

宝石列表 |切-d""-f1 |xargs gem uninstall -aIx

cat installed_gems |xargs sudo gem 安装

这篇关于Gem::安装错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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