加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

腐蚀的红宝石宝石系统

发布时间:2020-12-16 20:45:41 所属栏目:百科 来源:网络整理
导读:不知何故,我的红宝石宝石被腐蚀了,当我这么做的时候 $sudo gem update 我明白了: ERROR: While executing gem ... (Gem::Exception) Invalid spec cache file in /home/sawa/.gem/specs/api.rubygems.org%443/specs.4.8 我删除了.gem,并重新安装了Ruby,但问
不知何故,我的红宝石宝石被腐蚀了,当我这么做的时候
$sudo gem update

我明白了:

ERROR:  While executing gem ... (Gem::Exception)
    Invalid spec cache file in /home/sawa/.gem/specs/api.rubygems.org%443/specs.4.8

我删除了.gem,并重新安装了Ruby,但问题仍然存在.我该怎么修呢?

解决方法

首先,我建议您保存您的宝石列表,以防万一:
$gem list > gems.txt

要验证您使用的是您认为自己的SPEC CACHE:

$gem env | grep "SPEC CACHE"
 - SPEC CACHE DIRECTORY: /home/sawa/.gem/specs

要查看您是否有任何过时的来源:

$gem sources

如果您要小心,可以逐个删除源,然后重新添加. (见下面的代码)

尝试pristine,虽然它可能会失败:

$gem pristine --all

苛刻的方法是删除所有宝石规格:

rm -rf /home/sawa/.gem/specs

核方法是删除你已编写的gem目录:

rm -rf /home/sawa/.gem

我最好的猜测是你的一个宝石源正在返回一个不正确的文件,可能是一个临时问题.您可以通过删除所有宝石来源来解决这个问题.

$gem sources -?-clear-all # clears the cache,but doesn't remove the source
$gem sources --update  # probably will work,in which case you can stop now.

如果清除源不起作用,则可以删除所有并重新添加:

$gem sources 
$gem sources --remove http://gems.rubyforge.org/
$gem sources --remove http://gems.github.com
...etc ...
$gem sources -?-update  # should work fine,because there are no sources
$gem sources --add http://gems.rubyforge.org/
$gem sources --update
$gem sources --add http://gems.github.com
$gem sources --update
...etc...

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读