Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: While executing gem ... (NoMethodError) undefined method `spec' for nil:NilClass

I'm trying to get started with ruby and Watir-webdriver for some test automation.

sudo apt-get install ruby rubygems

sudo gem install watir-webdriver

Whenever I gem install I'm getting these errors like :

[/usr/lib/ruby/gems/1.8/specifications/selenium-webdriver-2.13.0.gemspec] isn't a Gem::Specification (NilClass instead).
ERROR:  While executing gem ... (NoMethodError)
    undefined method `spec' for nil:NilClass
like image 341
wim Avatar asked Nov 29 '11 01:11

wim


2 Answers

The problem was due to corrupted downloads being stored in the cache, so that even after gem uninstall and reinstall, the error persisted. To force re-download, I emptied the cache directories which are found by checking under GEM PATHS in the output of the command gem env.

like image 79
wim Avatar answered Sep 24 '22 15:09

wim


You should try using Ruby 1.9.x

The easiest way is to use RVM:

sudo apt-get install git
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
rvm install 1.9.2
rvm use 1.9.2
gem install watir-webdriver
like image 29
Alister Scott Avatar answered Sep 22 '22 15:09

Alister Scott