Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing gems [closed]

Tags:

I am getting an error when installing certain gems. I am using ubuntu 10.10. The error messages shows this.

ERROR:  While executing gem ... (NoMethodError)
undefined method `spec' for nil:NilClass
like image 425
Mazzn Avatar asked Oct 22 '10 18:10

Mazzn


1 Answers

I had exactly the same error as this...

While installing Rails 3 my computer suffered a power outage. After restarting the computer and continuing the Rails 3 installation the process failed with this exact same error. The problem was due to the gem install cache which had corrupted / empty gem files. My solution was to clear this cache and run the install again, as follows:

  1. Find out the location of your cache using gem env
  2. List all the gems in that cache, e.g. ls -l /usr/lib/ruby/gems/1.8/cache/
  3. Compare with successfully installed gems using gem list
  4. Remove the gems from the cache list that are missing from the gem list e.g. using rm
  5. I also had to remove some empty / corrupt gemspec files from the specification directory ls -l /usr/lib/ruby/gems/1.8/specifications/
  6. Continue the installation, e.g. sudo gem install -v=3.0.6 rails --no-rdoc --no-ri

Hope this helps someone else who has a power outage or other external failure during a gem install process!

like image 182
Darren Jensen Avatar answered Oct 15 '22 23:10

Darren Jensen