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

痞子三分冷 提交于 2019-12-31 17:57:24

问题


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

git clone -o heroku git@heroku.com: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.


回答1:


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




回答2:


simply run

bundle --full-index

that should do the trick




回答3:


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.




回答4:


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




回答5:


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



来源:https://stackoverflow.com/questions/11885398/is-there-a-fix-for-the-could-not-find-gem-in-any-of-the-sources-error-that-d

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!