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


当前回答

我在Terminal中执行了这些命令,并为我工作:

/usr/bin/ruby -e "$(curl - ssl https://raw.githubusercontent.com/Homebrew/install/master/install)" Brew安装ruby,可能需要sudo (sudo Brew install ruby)。 echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile . bat 源~ / . bash_profile Sudo宝石原始——全部

其他回答

当你在Mac上开发然后构建Docker映像时,这也是一个问题: https://forums.aws.amazon.com/thread.jspa?messageID=879802&tstart=0

当你执行“bundle install -deployment”时,bundle将创建一个 供应商目录w/你的宝石在里面。请注意,这包括 您的宝石在本地文件夹,它将只包括本地 为您的平台扩展。如果你用的是macOS,这就是达尔文。 您需要在64位x86 linux上重复这个过程 环境。

就我而言,我试图保持原始状态——但我得到的是:

Ignoring ffi-1.11.1 because its extensions are not built.  Try: gem pristine ffi --version 1.11.1
Ignoring jaro_winkler-1.5.3 because its extensions are not built.  Try: gem pristine jaro_winkler --version 1.5.3
Ignoring psych-3.1.0 because its extensions are not built.  Try: gem pristine psych --version 3.1.0
/.rbenv/versions/2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': incompatible library version - /.gem/gems/psych-3.1.0/lib/psych.bundle (fatal) 

然后,我删除了Users/{{user.name}}} /⁨.gem上的内容,然后当我需要运行bundle install—force时,它重新安装了所有内容,然后命令原始—一切都按预期工作

如果你像我一样使用rvm,修复可以很简单:

rvm get stable
rvm reload

如此答案https://apple.stackexchange.com/a/192513所述

Libby建议我开始一个新的终端会话(她对Sebastian Kim的回答进行了评论),这对我很有效。比其他任何一个都快,所以我想让它成为一个答案,这样它更明显。

运行gem primitive——一开始都没有帮助,但后来我意识到:我运行的脚本是这样开头的:

# !/ usr / bin / ruby

在我的macOS系统(Catalina,但我认为这无关紧要)上,这指向系统自带的Ruby,而不是RVM安装的Ruby。运行gem质朴——所有这些都是修复RVM安装,但我的脚本调用了不同版本的Ruby。

我的解决方法是使用env命令来调用当前shell的PATH中指定的Ruby。改变脚本的顶部行,以固定它:

# !/ usr / bin / ruby环境