1

Following the guide located here to setup ruby on rails: https://gorails.com/setup/ubuntu/14.04

I'm able to install ruby just fine using rbenv. I was able to get github setup. The step I'm getting an error on is when installing rails.

The 'gem install rails' command produces the following error:

matt@matt-desktop:~$ gem install rails
ERROR:  While executing gem ... (Gem::Exception)
    Invalid spec cache file in /home/matt/.gem/specs/api.rubygems.org%443/latest_specs.4.8

Any thoughts on how to overcome error?

mtcrts70
  • 35
  • 4
  • 19
  • I literally just had this error (not on ubuntu). here's my question: http://stackoverflow.com/questions/28402693/invalid-spec-cache-file-in-latest-specs-rb – Taryn East Feb 09 '15 at 04:13
  • I just tried a bunch of things and eventually it worked, but you can see the things I tried, and the one that eventually got it to work in the above – Taryn East Feb 09 '15 at 04:14
  • thanks I'll take a look.First time I've ever run into this error before and I've set up the rails environment a couple times now. I decided to dual boot windows 8.1 and ubuntu today which forced me to set up the environment from scratch again on ubuntu side. – mtcrts70 Feb 09 '15 at 04:26
  • Yeah me either - it's an odd one and it threw me... I discovered that that dir has the specs.4.8 file, but not latest_specs.4.8 - so somethings gone a bit weird... – Taryn East Feb 09 '15 at 04:26
  • Why are you installing rails seperately , install rvm and create an application . The rails version can be installed via bundle install command . – Caffeine Coder Feb 09 '15 at 05:14

2 Answers2

1

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
0

I had problems for a few weeks setting a full rails development environment on ubuntu 14.04. After a lot of headaches I came up with a solution for a lazy man, works without a problem. Just try

\curl -sSL https://get.rvm.io | bash -s stable --rails

It's not going to do the job first time, you have to import a key, you have an explanation in the terminal above. Just copy/paste the line with the command. Then run the curl again and it will install rvm, then rails and the ruby itself. The easiest way I found so far. Hope this helps.

Cvorak
  • 1
  • 2