问题
On both my work and home computers, I recently upgraded Ruby to 2.3.1, using ruby-install
. I use chruby
as my Ruby switcher.
I started seeing this warning in my terminal:
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
On my work, computer, the list was much longer, but easy to resolve. When I tried the suggested gem pristine GEM
, it told me it couldn't find the gem, so I ran gem install GEM
, and that solved it.
At home, nothing is working.
Things I have tried, from common sense and various other Stack questions:
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, thenbrew update
andbrew 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.)
回答1:
I came across this exact issue today - getting warnings like this for gems that weren't even installed!
... Well, it turns out the gems were installed - for a different ruby than the one I had set active with chruby (2.2.3 vs 2.3.1).
Switching to all the different rubies and running gem pristine --all
on all of them solved the problem.
回答2:
I ran into this issue and followed all the same commands as above, even going so far as to remove all my previously installed Ruby versions. However, the error persisted.
Turns out, there were some leftover gems for the various (previously uninstalled) versions in ~/.gem/ruby/
. After removing the folders I no longer used, the errors disappeared.
回答3:
I've had this problem today too and it frustrated because I couldn't type because my whole editor flashed red with error messages.
I'm not entirely sure what exactly caused it but I believe it's because we have multiple ruby versions OR multiple ruby version managers installed and they overwrite each other and otherwise mess up your paths towards the gems.
The gem
command also gets overwritten when you have rbenv and rvm.
See which ones you've installed by typing;
which rvm
which rbenv
which chruby
If one of those is installed it'll return a path. Then delete them, make sure to completely clean out all the directories and start with a clean install.
Remove
Here's what I did for rvm;
rvm implode
gem uninstall rvm
rm -rf ~/.rvm
rm -rf ~/.rvmrc
Here's what I did for rbenv
First installed https://github.com/bernsie/rbenv-clean, then
rbenv clean
sudo apt-get remove rbenv
rm -rf ~/.rbenv
Reinstall
Then you have a clean home directory to work from. I reïnstalled rbenv with How to install Ruby 2.1.4 on Ubuntu 14.04. And finally;
rbenv rehash
回答4:
I did everything mentioned above including
- xcode-select --install
- reinstall ruby
- reinstall all gems
- gem pristine --all
but the issue was the same for me. I just rebooted my Mac as the last hope, and the warning messages are disappeared.
Weird, but if anyone's struggling with this issue after trying everything on StackOverflow, try reboot your machine.
回答5:
If you have installed RVM, possible you're catching the error because you have installed different versions.
Check and remove useless versions, but I think this is not good approach. Anyway errors gone.
rvm list
rvm use ruby-version
rvm remove ruby-useless-version
After refresh cocoapods, it should be injected in .rvm GEM_HOME
gem uninstall cocoapods
gem install cocoapods
Probably pod COMMAND
will throw the error about minitest
gem, so – gem install minitest
回答6:
TL;DR - Ruby gems don't like Rubies running from symlinks or moved from where they were built (because of embedded shebangs)
If the Ruby directory is invoked or environment vars point to a symlink'ed directory, or are copied or renamed, this message is likely. I am using chruby and was symlinking /opt/rubies/
-> /usr/local/ruby/
, but Ruby's dynamic library-finding logic doesn't play well with this.
The solution in my case was to replace the symlink with actual rubies in /opt/rubies/
and run gem pristine --all
in each Ruby. For others using RVM or Rbenv, good luck with that without starting over from scratch.
This may not be your exact issue, but hopefully it helps.
回答7:
This is an old thread, but I just came across this issue myself.
You don't need to restart your machine, you just need to refresh your environment, you can do this with the rehash command:
rehash
From the man page: rehash command re-computes the internal hash table of the contents of directories listed in the path environmental variable to account for new commands added.
回答8:
Adding my own flavor here. I use rbenv
installed via Homebrew and was getting four of these "ignoring... extensions not built" messages. Specifically:
Ignoring bcrypt-3.1.12 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.12
Ignoring bindex-0.5.0 because its extensions are not built. Try: gem pristine bindex --version 0.5.0
Ignoring bootsnap-1.3.2 because its extensions are not built. Try: gem pristine bootsnap --version 1.3.2
Ignoring byebug-10.0.2 because its extensions are not built. Try: gem pristine byebug --version 10.0.2
I tried many things in this thread with no luck. Finally in my case I did:
brew uninstall rbenv
rm -rf ~/.rbenv
brew install rbenv
At this point I was still getting the errors, but now I had only a single Ruby version to contend with:
$ rbenv versions
* system (set by /Users/will/.rbenv/version)
At this point I tried sudo gem pristine --all
but was rejected for permissions on the system Gems directory.
So I went through and ran pristine on each gem, like
sudo gem pristine bcrypt --version 3.1.12
(etc)
And finally the errors were gone.
回答9:
Uninstall and reinstall of Vagrant also works. There's an unistall.tool
bash script included in the installer .dmg image that will remove Vagrant.
Found this solution here: Updating Vagrant and Gems Extentions Not Built In
回答10:
I had the same issue and I'm using rbenv. For some reason my global rbenv setting went missing. In order to fix this problem I set the global version to one of my rbenv versions... for instance:
rbenv global 2.5.1
回答11:
This is also a problem when you're developing on Mac and then build a Docker image: https://forums.aws.amazon.com/thread.jspa?messageID=879802&tstart=0
When you do a "bundle install --deployment", bundler will create a vendor directory w/ your gems in it. Note that whilst this includes your gems in the local folder, it will only include the native extensions for your platform. As you're on macOS this will be Darwin. You'll need to do repeat the process on a 64-bit x86 linux environment.
回答12:
Libby's suggestion to just start a new terminal session (which she commented on Sebastian Kim's answer) worked for me. Much quicker than any of the others too so I wanted to make it an answer so it was more visible.
回答13:
On my case I was trying to run pristine --all
but I was getting:
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)
Then, I deleted the content on Users/{{user.name}}/.gem
then as I needed to run bundle install --force
, it reinstalled everything, then the command pristine --all
worked as expected
来源:https://stackoverflow.com/questions/38797458/ignoring-gem-because-its-extensions-are-not-built