ben
ben

Reputation: 29797

Is there a fix for the "Could not find *gem* in any of the sources" error that doesn't involve deleting Gemfile.lock?

I am trying to get my development environment setup on a new computer.

git clone -o heroku [email protected]:theirapp.git
cd theirapp
bundle
Fetching gem metadata from https://rubygems.org/......
Fetching gem metadata from https://rubygems.org/..
Could not find jquery-rails-2.0.0 in any of the sources

After googling this error, the response seems to be to delete Gemfile.lock, then running bundle again. This works, but then I have different versions of gems where I haven't specified a version in Gemfile. Is there a way to fix this error without deleting Gemfile.lock? I'm using Rails 3.2 and Ruby 1.9.3.

Upvotes: 55

Views: 76585

Answers (10)

Ponny
Ponny

Reputation: 702

In my case the gem had underscores in the name but I had used hyphens

Upvotes: 0

Shivam kumar
Shivam kumar

Reputation: 46

For me bundle update followed by gem pristine racc worked. It was something related to native repository.

Upvotes: 1

Dirk
Dirk

Reputation: 1194

In my case, the only thing that helped was a

bundle install --force

Looked like bundler thought the dependencies have been installed. But turns out it wasn't correctly.

Upvotes: 5

In my case, this error was caused by a frozen lockfile. Editing my-repository-root/.bundle/config to set BUNDLE_FROZEN: "false" fixed the problem.

bundle install did not change the lockfile afterwards, so I don't understand why BUNDLE_FROZEN broke anything to begin with...

Upvotes: 1

napster235
napster235

Reputation: 9

I had the same issue but with a different gem. Running gem install yourgem -v 1.x.x solved my problem.

Upvotes: 0

Hoa
Hoa

Reputation: 3207

According to rubygems.org, jquery-rails 2.0.0 has been yanked. That explains the error you had with jquery-rails.

Running $ bundle update jquery-rails will rebuild your gem snapshot. That way you don't have to delete Gemfile.lock

Upvotes: 26

Harlan T Wood
Harlan T Wood

Reputation: 2434

An old version of bundler was giving me this same issue. After a bunch of puzzling, I realized that this was the issue.

Running gem install bundler fixed it completely.

Upvotes: 8

Jamie-505
Jamie-505

Reputation: 1260

simply run

bundle --full-index

that should do the trick

Upvotes: 49

pwightman
pwightman

Reputation: 794

bundle update jquery-rails will update just the jquery-rails gem, which is likely what you're looking for. Running bundle update is the equivalent of deleting Gemfile.lock and is not recommended in most cases. See here: Heroku push rejected: can't find jquery-rails-2.0.0 in sources

Upvotes: 4

pixelearth
pixelearth

Reputation: 14630

I've found it safest ALWAYS to specify gem versions, and only change them when necessary. Saved me a LOT of trouble.

Upvotes: 4

Related Questions