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

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

问题描述

我将从通常的小白线开始,我是新手。噢,我正在运行Mac OSX 10.6.4



我一直在关注一系列指南来设置,特别是这两个这里此处。这些指南非常棒,我使用第二个的原因是因为RVM,我使用第一个的原因是MYSQL。



无论如何,当我开始,我没有完全按照方向,所以在我安装RVM后,出于某种原因,我安装了 sudo gem install rails -v 2.3.8 的rails,因为这是版本我需要。所以......我意识到我使用的是系统ruby,并没有充分利用RVM。我现在所做的是安装Ruby 1.9.2,所以我可以安装rails 3并进行测试,并且我还安装了1.8.7和rails 2.3.8,因此我可以将它用于我需要的内容。



现在,我试图从系统Ruby中卸载gems,但是每当我尝试给出这个错误时:


错误:执行gem时...
(Gem :: InstallError)

无法卸载,请检查'gem list -d
我尝试卸载的任何宝石 '


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






更新:



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

解决方案

!!我仍然不明白为什么会发生这种情况,如果有人能够解释,我很乐意。为什么路径不存在?是什么导致了这个错误?



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



没有进一步的结果 - 事实证明,当试图卸载宝石,它无法找到它的路径(我认为问题是因为用sudo安装,但我可能是错的)。你需要做的是(你必须为每个宝石做一个一个的,或者至少我不得不这样做): code> gem list -d'gem'的名称并记下Installed at:位置(在我的例子中是/System/Library/Frameworks/Ruby.framework/Versions/1.8/

  • sudo gem uninstall'gem'的名称-i'上面提到的路径' (例如,在我的情况下, sudo gem uninstall rails -i /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

  • 有些gem仍然可能不会卸载返回权限错误,如果是这种情况,你需要做的是在上面的路径中创建一个文件夹/ bin(在我的情况下, mkdir /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/bin

  • 继续卸载,如第2步所述,仍然使用原始路径(/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8)。

  • ol>

    现在全部卸载应该可以工作!


    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

    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.

    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.

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

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

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


    UPDATE:

    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?

    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.

    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' 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天全站免登陆