卸载 rails 和 gems,出现错误“无法卸载,检查 'gem list -d ...' [英] Uninstalling rails and gems, getting error "cannot uninstall, check 'gem list -d ...'

查看:27
本文介绍了卸载 rails 和 gems,出现错误“无法卸载,检查 'gem list -d ...'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将从通常的菜鸟行开始,我是 Rails 新手".哦,我正在运行 Mac OSX 10.6.4

I'm going to start with the usual noob line, "I'm new to rails". Oh, and I'm running Mac OSX 10.6.4

我一直在按照一堆指南进行设置,特别是这两个 这里这里.指南很棒,我使用第二个的原因是 RVM,而我使用第一个的原因是 MYSQL.

I've been following a bunch of guides to get set up, specifically these two here and here. The guides are great, the reason I'm using the second one is because of RVM and the reason I'm using the first is for MYSQL.

无论如何,当我开始时,我并没有完全按照说明进行操作,所以在安装 RVM 后,出于某种原因,我使用 sudo gem install rails -v 2.3.8 安装了 rails,因为那是我需要的版本.所以......我意识到我正在使用系统红宝石,并没有利用 RVM.我现在所做的是安装 Ruby 1.9.2,这样我就可以安装 rails 3 并对其进行测试,我还安装了 1.8.7 和 rails 2.3.8,这样我就可以将它用于我需要的地方.

Anyway, when I started, I wasn't following the directions completely and so after I installed RVM, for some reason I installed rails with sudo gem install rails -v 2.3.8 because thats the version I need. So... I realized I was using the system ruby, and wasn't taking advantage of RVM. What I did now was install Ruby 1.9.2 so I can install rails 3 and test it out, and I also installed 1.8.7 and rails 2.3.8 so I can use it for what I need it.

现在,我正在尝试从系统 Ruby 中卸载 gem,但每当我尝试时,我都会收到此错误:

Now, I'm trying to uninstall the gems from the system Ruby, but whenever I try to I'm getting this error:

错误:执行 gem 时...(Gem::InstallError)
无法卸载,检查'gem list -d无论我尝试卸载什么 gem'

ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check 'gem list -d whatever gem I try to uninstall'

关于如何移除铁轨和所有这些宝石的任何想法?我只想从头开始使用 RVM.

Any ideas on how to remove rails and all these gems? I just want to start from scratch with RVM.

更新:

通过运行命令 gem list -d rails 我在/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/18 中找到了 gem.我应该手动删除它们吗?

By running the command gem list -d rails I've located the gems in /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/18. Should I delete them manually?

推荐答案

解决方案!!我仍然不明白为什么会发生这种情况,如果有人可以解释,我会很高兴.为什么路径不存在?是什么导致了这个错误?

SOLUTION!! I still don't understand why this happened, I'd love if someone could explain. Why was the path non-existant? What caused this error?

另外,我想提一下,我链接到的解决方案有一条评论说问题是重复的.但是,原版有不同的解决方案,并没有帮助我(尽管它是找到这个答案的基础).简单地在 finder 中手动删除 gem 不会将它们从 gem 列表中删除.

Also, I want to mention that the solution I linked to has a comment saying that the question is a duplicate. However, the original has a different solution and did not help me (though its the basis to finding this answer). Simply deleting the gems manually in finder would not remove them from the gem list.

事不宜迟 - 事实证明,当尝试卸载 gem 时,它找不到它的路径(我认为问题是因为使用 sudo 安装,但我可能错了).你需要做的是(你必须为每个宝石一个一个地做这个,或者至少我必须这样做):

Without further ado - it turns out that when trying to uninstall the gem, it can't locate its path (I think the problem is because of installing with sudo, but I might be wrong). What you need to do is (you have to do this one by one for each gem, or at least I had to):

  1. gem list -d 'name of gem' 并注意安装在:"位置(在我的例子中,/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8)
  2. sudo gem uninstall 'name of gem' -i '上述路径'(例如,在我的例子中,sudo gem uninstall rails -i/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
  3. 某些 gem 可能仍无法卸载并返回权限错误.如果是这种情况,您需要做的是在上面的路径中创建一个文件夹/bin.(在我的例子中,mkdir/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/bin
  4. 按照步骤 2 继续卸载,仍然使用原始路径 (/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8).
  1. gem list -d 'name of gem' and note the "Installed at:" location (in my case, /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8)
  2. sudo gem uninstall 'name of gem' -i 'the path noted above' (ex. in my case, sudo gem uninstall rails -i /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
  3. Some gems still might not uninstall returning a permissions error. If this is the case, what you need to do is create a folder /bin, in the path above. (in my case, mkdir /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/bin
  4. Continue uninstalling as in step 2, still using the original path (/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8).

现在所有的卸载都应该可以工作了!

Now all uninstalls should work!

这篇关于卸载 rails 和 gems,出现错误“无法卸载,检查 'gem list -d ...'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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