在我的工作电脑和家用电脑上,我最近使用Ruby -install将Ruby升级到2.3.1。我使用chruby作为Ruby切换器。

我开始在我的终端上看到这样的警告:

Ignoring bcrypt-3.1.11 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.11
Ignoring bcrypt-3.1.10 because its extensions are not built.  Try: gem pristine bcrypt --version 3.1.10
Ignoring binding_of_caller-0.7.2 because its extensions are not built.  Try: gem pristine binding_of_caller --version 0.7.2
Ignoring byebug-9.0.5 because its extensions are not built.  Try: gem pristine byebug --version 9.0.5
Ignoring byebug-5.0.0 because its extensions are not built.  Try: gem pristine byebug --version 5.0.0
Ignoring concurrent-ruby-ext-1.0.2 because its extensions are not built.  Try: gem pristine concurrent-ruby-ext --version 1.0.2
Ignoring debug_inspector-0.0.2 because its extensions are not built.  Try: gem pristine debug_inspector --version 0.0.2

在我的工作电脑上,清单要长得多,但很容易解决。当我尝试建议的gem原始gem时,它告诉我找不到宝石,所以我运行gem安装gem,这就解决了问题。

在家里,一切都不正常。

我从常识和其他Stack问题中尝试过的事情:

gem pristine GEM gem pristine --all uninstalling and reinstalling the gem gem update gem update --system bundle update uninstalling and reinstalling bundler uninstalling and reinstalling rails (Though, it's not a Rails specific problem.) deleting ~/.bundle/ opening XCode and letting it install some extensions (It did need to do it, but it didn't fix anything.) running brew doctor and solving all the minor issues, then brew update and brew upgrade gem install curb (I can't imagine what this gem has to do with this issue, but two different people listed it as the last step of their fix to the same warning.)


当前回答

我今天也遇到了这个问题,它让我很沮丧,因为我无法打字,因为我的整个编辑器闪烁着红色的错误消息。

我不完全确定到底是什么原因导致的,但我相信这是因为我们安装了多个ruby版本或多个ruby版本管理器,它们相互覆盖,否则就会扰乱你通往宝石的路径。

当您有rbenv和rvm时,gem命令也会被覆盖。

通过输入查看您已经安装了哪些;

which rvm
which rbenv
which chruby

如果安装了其中一个,它会返回一个路径。然后删除它们,确保完全清理所有目录,并开始全新安装。


删除

这是我对rvm所做的;

rvm implode
gem uninstall rvm
rm -rf ~/.rvm
rm -rf ~/.rvmrc

这是我对rbenv所做的

首先安装https://github.com/meowsus/rbenv-clean,然后

rbenv clean
sudo apt-get remove rbenv
rm -rf ~/.rbenv

重新安装

然后就有了一个干净的主目录。我reïnstalled rbenv与如何安装Ruby 2.1.4 Ubuntu 14.04。最后;

rbenv rehash

其他回答

TL;DR - Ruby宝石不喜欢红宝石从符号链接中运行或从它们构建的地方移动(因为嵌入式shebangs)

如果Ruby目录被调用,或者环境变量指向一个符号链接的目录,或者被复制或重命名,就可能出现此消息。我使用chruby和符号链接/opt/rubies/ -> /usr/local/ Ruby /,但Ruby的动态库查找逻辑不能很好地发挥这一点。

在我的案例中,解决方案是将符号链接替换为/opt/ Ruby /中的实际红宝石,并运行gem质朴——所有这些都在每个Ruby中。对于其他使用RVM或Rbenv的用户,祝您好运,不必从头开始。

这可能不是你的问题,但希望它能有所帮助。

这个解决方案对我的RubyMine IntelliJ很有效

我有两个不同的终端正在使用RVM和ruby<版本>。

解决方案:

我不得不将其切换到RVM版本,以便在首选项>语言和框架>Ruby SDK中消除错误

错误:

Ignoring executable-hooks-1.6.0 because its extensions are not built. Try: gem pristine executable-hooks --version 1.6.0 rubymine

Ignoring gem-wrappers-1.4.0 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.4.0

我遇到了这个问题,并执行了与上面相同的所有命令,甚至删除了之前安装的所有Ruby版本。然而,错误仍然存在。

事实证明,在~/.gem/ruby/中有一些剩余的宝石用于各种(以前卸载的)版本。删除我不再使用的文件夹后,错误就消失了。

在我的例子中,警告本身已经给出了解决方案,所以我只是一个一个地运行它们。

Ignoring bigdecimal-2.0.0 because its extensions are not built. Try: gem pristine bigdecimal --version 2.0.0
Ignoring date-3.0.1 because its extensions are not built. Try: gem pristine date --version 3.0.1
Ignoring dbm-1.1.0 because its extensions are not built. Try: gem pristine dbm --version 1.1.0
Ignoring etc-1.1.0 because its extensions are not built. Try: gem pristine etc --version 1.1.0

这里有一个例子:

gem pristine bigdecimal --version 2.0.0

因此,运行每一行的命令就解决了我的问题。

我有这个问题,但只有当我启动tmux会话使用tmuxinator。

原来这是因为我使用tmuxinator从brew而不是安装它使用gem安装。也许同时使用chruby也导致了这个问题。

p/s:我也从~/中删除了未使用的ruby。宝石/红宝石,但我怀疑这是这个问题为我解决的原因。