Ignoring GEM because its extensions are not built

前端 未结 18 1351
陌清茗
陌清茗 2020-12-04 06:35

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 seei

相关标签:
18条回答
  • 2020-12-04 07:16

    If you are using rvm like me, the fix could a simple:

    rvm get stable
    rvm reload
    

    As stated in this answer https://apple.stackexchange.com/a/192513

    0 讨论(0)
  • 2020-12-04 07:17

    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

    0 讨论(0)
  • 2020-12-04 07:18

    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.

    0 讨论(0)
  • 2020-12-04 07:18

    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.

    0 讨论(0)
  • 2020-12-04 07:19

    I had this problem but only when I was starting tmux session using tmuxinator.

    Turned out it's because I'm using tmuxinator from brew instead of installing it using gem install. Maybe using chruby at the same time contributed to the problem as well.

    p/s: I also removed unused ruby from ~/.gem/ruby but I doubt that's the reason this issue was resolved for me.

    0 讨论(0)
  • 2020-12-04 07:20

    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.

    0 讨论(0)
提交回复
热议问题