在我的工作电脑和家用电脑上,我最近使用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.)


当前回答

我也有同样的问题,我用的是rbenv。由于某种原因,我的全局rbenv设置丢失了。为了解决这个问题,我将全局版本设置为我的rbenv版本之一…例如:

Rbenv global 2.5.1

其他回答

如果您已经安装了RVM,则可能因为安装了不同的版本而捕捉到错误。

检查和删除无用的版本, 但我认为这不是一个好方法。 不管怎样,错误消失了。

rvm list
rvm use ruby-version
rvm remove ruby-useless-version

刷新cocoapods后,应该将其注入到.rvm GEM_HOME中

gem uninstall cocoapods
gem install cocoapods

可能pod COMMAND会抛出关于minitest gem的错误,所以- gem install minitest

我今天遇到了这个确切的问题-得到这样的警告,宝石甚至没有安装!

... 好吧,结果是安装了宝石-不同于我用chruby设置的激活的红宝石(2.2.3 vs 2.3.1)。

切换到所有不同的红宝石和运行宝石原始-所有他们都解决了问题。

卸载和重新安装的流浪者也工作。有一个卸载。工具bash脚本包含在安装程序的.dmg映像中,将删除Vagrant。

发现这个解决方案在这里:更新流浪者和宝石扩展不内置

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

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

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

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

运行Mac OS Catalina, brew和rbenv…

今天遇到了这个问题,并且看过了这里所有的答案,我最终发现了这个错误的另一个原因:

忽略nokogiri 1.10.7,因为它的扩展没有被构建。试试:gem primitive nokogiri——1.10.7版本

当然,宝石原始没有工作。

我的问题是硬编码的GEM_HOME和GEM_PATH环境变量覆盖了rbenv。

因此,检查您没有在~/.zshrc中设置GEM_PATH和GEM_HOME