5

After run bundle install I get this error:

Gem::Package::FormatError: no metadata found in /Users/jeanosorio/.rvm/gems/ruby-1.9.3-p286/cache/libv8-3.11.8.13-x86_64-darwin-12.gem
An error occurred while installing libv8 (3.11.8.13), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.11.8.13'` succeeds before bundling.

I try with

gem install libv8 -v '3.11.8.13'

But I get

ERROR:  Error installing libv8:
    invalid gem format for /Users/jeanosorio/.rvm/gems/ruby-1.9.3-p286/cache/libv8-3.11.8.13-x86_64-darwin-12.gem

What is the problem here. Please some help.

Jean
  • 5,201
  • 11
  • 51
  • 87
  • Not sure what the problem is, but I've had the exact same one. I seem to remember being able to get around it with homebrew. I had all kinds of problems with libv8 after upgrading to the Xcode that came out with mountain lion. – bennett_an Feb 08 '13 at 17:05

1 Answers1

9

The Gem::Package::FormatError: no metadata found in ... error message indicates that the content of Ruby's cache directory gets out of sync with the actual gem repository.

The error can be fixed by removing either the offending file or the complete cache folder, and running bundle install again.

First try removing the offending file:

rm ~/.rvm/gems/ruby-1.9.3-p286/cache/libv8-3.11.8.13-x86_64-darwin-12.gem
bundle install

That should fix the problem. If it doesn't, remove the complete cache folder:

 rm -rf ~/.rvm/gems/ruby-1.9.3-p286/cache/
 bundle install

Ref:

  1. Rails: Fixing Bundle “No Metadata Found” issues
  2. Bundler issue : No metadata found
  3. SO answer to RubyGems issue on OSX

Additionally, it might be worth updating rubygems version with gem update --system as mentioned in this answer

Community
  • 1
  • 1
Prakash Murthy
  • 12,923
  • 3
  • 46
  • 74
  • I uninstall and reinstall it with [the argument](http://stackoverflow.com/questions/19673714/rails-gem-install-error-error-installing-libv8-error-failed-to-build-gem-nati) as root. Not works. My Error is `An error occurred while installing libv8 (3.16.14.3), and Bundler cannot continue.` and `Bundler::GemspecError: Could not read gem at /home/gitlab/gitlab/vendor/bundle/ruby/2.1.0/cache/libv8-3.16.14.3-x86_64-linux.gem. It may be corrupted.` I remove the whole cache and re-run `bundle install --full-index --deployment --without development test postgres aws`. Works. – Nick Dong Mar 02 '16 at 11:17