1

I created a new RoR application, but whenever I run bundle install (which installs RSpec along other gems) I get the following error:

Gem::Package::FormatError: no metadata found in /Users/petarpetrovic/.rvm/gems/ruby-1.9.3-p194/cache/selenium-webdriver-2.22.0.gem An error occured while installing selenium-webdriver (2.22.0), and Bundler cannot continue. Make sure that gem install selenium-webdriver -v '2.22.0' succeeds before bundling.

When I run gem install selenium-webdriver -v '2.22.0', I get the following error message:

ERROR: Error installing selenium-webdriver: invalid gem format for /Users/petarpetrovic/.rvm/gems/ruby-1.9.3-p194/cache/selenium-webdriver-2.22.0.gem

I tried manually removing the gem from cache folder and then rerun bundle install but I still get the same error messages.

Any ideas how to fix this?

Andrew Marshall
  • 95,083
  • 20
  • 220
  • 214

3 Answers3

4

Update gems

gem update --system
gem update

Check Gemfile in your rails application. Should content: gem "selenium-webdriver", "~> 2.22.0"

Run bundle install again.

Alexander
  • 1,299
  • 2
  • 12
  • 32
  • I think that needs to be `gem update --system`, with a `sudo` in front of it if OP isn't using RVM or similar. – Mark Reed May 30 '12 at 13:53
  • It seems he is using rvm: /Users/petarpetrovic/.rvm/gems... But gems system update seems to be reasonable too. Thanks :) – Alexander May 30 '12 at 13:54
  • There's no reason to run `gem update` after, especially when using Bundler. Also @MarkReed, while the command *may* need `sudo`, it's better, IMO, to give it without and allow the user to add it if they need to. Running without `sudo` gives at worst a permissions error, running with when you shouldn't works at first but screws up everything. – Andrew Marshall May 30 '12 at 14:23
  • To be fair, `gem update` may update `bundler` so it's not entirely useless. A better approach is `gem install bundler`. – tadman May 30 '12 at 15:12
  • He gets **invalid gem format** error even without bundle by **gem install selenium-webdriver -v '2.22.0'**. And selenium-webdriver gem was updated yesturday. I think system update will fix issue. – Alexander May 30 '12 at 15:26
1

I don't quite understand the above solution although it might work for someone. I ran into the same error but with different gem. I got problem with nokogiri and got this error message:

Gem::Package::FormatError: no metadata found in /home/myname/.rvm/gems/ruby-1.9.3-p194/cache/nokogiri-1.5.5.gem

I went to /home/myname/.rvm/gems/ruby-1.9.3-p194/cache/ and removed the file nokogiri-1.5.5.gem and I was able to run bundle again. I think there is something messed up with the .gem file.

u19964
  • 3,255
  • 4
  • 21
  • 28
0

Remove the cached copy of the gem and then try installing it again

rm -rf /Users/petarpetrovic/.rvm/gems/ruby-1.9.3-p194/cache/selenium-webdriver-2.22.0.gem
gem install selenium-webdriver -v '2.22.0'
Rupali
  • 311
  • 3
  • 5