Corrupted Ruby Gem System

Corrupted ruby gem system

First I suggest you save your gem list, just in case:

$ gem list > gems.txt

To verify that you're using the SPEC CACHE that you think you are:

$ gem env | grep "SPEC CACHE"
- SPEC CACHE DIRECTORY: /home/sawa/.gem/specs

To see if you have any outdated sources:

$ gem sources

If you want to be careful, you can remove sources one by one, then re-add. (See code below)

Try pristine, though it will likely fail:

$ gem pristine --all

The harsh approach is to delete all the gem specs:

rm -rf /home/sawa/.gem/specs

The nuclear approach is to delete the gem directory, which you write that you've already tried:

rm -rf /home/sawa/.gem

My best guess is that one of your gem sources is returning an incorrect file, possibly a temporary problem. You can figure this out by removing all your gem sources.

$ gem sources -​-clear-all # clears the cache, but doesn't remove the source
$ gem sources --update # probably will work, in which case you can stop now.

If clearing the sources doesn't work, then you can remove all and re-add:

$ gem sources 
$ gem sources --remove http://gems.rubyforge.org/
$ gem sources --remove http://gems.github.com
...etc ...
$ gem sources -​-update # should work fine, because there are no sources
$ gem sources --add http://gems.rubyforge.org/
$ gem sources --update
$ gem sources --add http://gems.github.com
$ gem sources --update
...etc...

Bundle install not running properly, gem corrupted

If you are using Bundler 1.1 or later you can use bundle clean, or bundle clean --force just as you imagined you could. This is redundant if you're using bundle install --path (Bundler manages the location you specified with --path, so takes responsibility for removing outdated gems), but if you've used Bundler to install the gems as system gems then bundle clean --force will delete any system gems not required by your Gemfile. Blindingly obvious caveat: don't do this if you have other apps that rely on system gems that aren't in your Gemfile!

Source -Bundle Clean

Corrupt Gemfile.Lock

The mismatch between deployment and development environments appears to be the root cause of the issue. Removing windows dependancies and compatibility using:

bundle lock --remove-platform x86-mingw32

And adding Linux support using:

lock --add-platform x86_64-linux

Appears to have fixed the issue.



Related Topics



Leave a reply



Submit