1

I have a similar problem to: Invalid spec cache file but it does not have an answer.

Our rails app recently upgraded from ruby 2.1.2 to 2.1.5

When I downloaded this onto my laptop (desktop working fine) it required be to rvm install 2.1.5, then create a new gemset for 2.1.5

I tried to run bundle and bundler isn't installed so I tried gem install bundler and it responded with the following error message:

ERROR:  While executing gem ... (Gem::Exception)
    Invalid spec cache file in /my_dir/.gem/specs/api.rubygems.org%443/latest_specs.4.8

On checking that directory, I find that there is a specs.4.8 file but not a latest_specs.4.8 file

Things I tried:

  • I deleted and re-created the gemset, same problem.
  • I ran gem update
  • I blew away /my_dir/.gem/specs and reran gem update
  • I ran gem update --system
  • I reinstalled ruby 2.1.5 and did it all again...

When I changed the ruby-version back to 2.1.2 and used rvm use 2.1.2; bundle it didn't have a problem (but then bundler already exists in that gemset).

Gem env:

RubyGems Environment:
  - RUBYGEMS VERSION: 2.2.2
  - RUBY VERSION: 2.1.5 (2014-11-13 patchlevel 273) [x86_64-darwin10.0]
  - INSTALLATION DIRECTORY: /my_dir/.rvm/gems/ruby-2.1.5
  - RUBY EXECUTABLE: /my_dir/.rvm/rubies/ruby-2.1.5/bin/ruby
  - EXECUTABLE DIRECTORY: /my_dir/.rvm/gems/ruby-2.1.5/bin
  - SPEC CACHE DIRECTORY: /my_dor/.gem/specs
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-10
  - GEM PATHS:
     - /my_dir/.rvm/gems/ruby-2.1.5
     - /my_dir/.rvm/gems/ruby-2.1.5@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
Community
  • 1
  • 1
Taryn East
  • 27,486
  • 9
  • 86
  • 108

2 Answers2

3

Try this:

gem sources --clear-all
gem sources --update

If that doesn't work, see my longer answer here: Corrupted ruby gem system

Community
  • 1
  • 1
joelparkerhenderson
  • 34,808
  • 19
  • 98
  • 119
  • thanks - haven't had a chance to try that yet (I'm back on the desktop today) but that sounds like a good list of things to look at. – Taryn East Feb 10 '15 at 05:45
  • Do you happen to know why latest_specs vs specs ? have rubygems changed something about what to name the file the specs are in? – Taryn East Feb 10 '15 at 05:46
0

Eventually I gave up and reinstalled ruby 2.1.5 and deleted the gemset.

Then it turned out I could install without bothering to first create a gemset.

Just rvm use 2.1.5 then gem install bundler then bundle

So: no idea what went wrong (and would still encourage others to answer for an explanation), but this is what worked for me.

Taryn East
  • 27,486
  • 9
  • 86
  • 108