Sparkplug
Sparkplug

Reputation: 495

Bundle install throwing error

I am getting the following error when I try to run bundle install

Bundler::GemspecError: Could not read gem at /usr/local/rvm/gems/ruby-1.9.3-p484@rails3tutorial/cache/turbolinks-2.1.0.gem. It may be corrupted.

An error occurred while installing turbolinks (2.1.0), and Bundler cannot continue.
Make sure that `gem install turbolinks -v '2.1.0'` succeeds before bundling.

Even if in install the above said gem and rub bundle install it throws a similar error and asks me to make sure an another gem is installed and this goes on and on. I am using Rails 4.0.2 and ruby 1.9.3p484.

Upvotes: 0

Views: 1047

Answers (2)

Martin Tournoij
Martin Tournoij

Reputation: 27852

I just had this problem with the bcrypt gem

Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...

Bundler::GemspecError: Could not read gem at /data/code/mdweb/vendor/bundle/ruby/2.1.0/cache/bcrypt-3.1.7.gem. It may be
 corrupted.
An error occurred while installing bcrypt (3.1.7), and Bundler cannot continue.
Make sure that `gem install bcrypt -v '3.1.7'` succeeds before bundling.

The /data/code/mdweb/vendor/bundle/ruby/2.1.0/cache/bcrypt-3.1.7.gem file was 0 bytes; removing this file or using the --no-cache option didn't help.

Using gem install bcrypt -v '3.1.7' did work, so I copied ~/.gem/ruby/2.1.0/cache/bcrypt-3.1.7.gem to /data/code/mdweb/vendor/bundle/ruby/2.1.0/cache/bcrypt-3.1.7.gem and that allowed me to continue. You could also fetch the .gem file from http://rubygems.org if you can't find it on your system.

I suspect there's some sort of connection issue with bundler (but not with gem for some reason); I suspect DNS since there's an unusual long wait before I get an error, but didn't investigate further.

Upvotes: 1

AWM
AWM

Reputation: 1140

Maybe the file cache got corrupted. Try:

bundle install --no-cache

If this does not work, delete the cache directory and try again:

rm -rf /usr/local/rvm/gems/ruby-1.9.3-p484@rails3tutorial/cache
bundle install

Upvotes: 2

Related Questions