简体   繁体   English

Bundler找不到某个版本的gem,但是同名的gem install有效

[英]Bundler cannot find a version of a gem, but gem install with the same name works

I've created a gem, and for some reason this one keeps bugging me, and refuses to install properly through bundler. 我创建了一个gem,由于某种原因,这个一直在烦我,并拒绝通过bundler正确安装。

Here's the Gemfile : 这是Gemfile

source 'https://rubygems.org'
gem 'rails', '3.2.9'
gem "switch_access-rails", "~> 1.1.6"

bundle install fails with: 捆绑安装失败:

Could not find gem 'switch_access-rails (~> 1.1.6) ruby' in the gems available on this machine.

This works: 这有效:

gem install switch_access-rails -v 1.1.6 

And the gem is here on rubygems: https://rubygems.org/gems/switch_access-rails/versions/1.1.6 宝石出现在rubygems上: https ://rubygems.org/gems/switch_access-rails/versions/1.1.6

I even tried bumping from version 1.1.5 to 1.1.6 just to see if that helped. 我甚至尝试从1.1.5版本升级到1.1.6,看看是否有帮助。

Installing version 1.1.4 in with bundle install works. 安装版本1.1.4 in bundle install工作。

Any tips on where to start looking/debugging bundle install? 有关从何处开始查看/调试捆绑安装的提示?

And after a whole day of googling I found this status update from Dec 12: http://twitter.com/rubygems_status/status/279019743166476288 经过一整天的谷歌搜索后,我发现12月12日的状态更新: http//twitter.com/rubygems_status/status/279019743166476288

bundle install --full-index

Seems to get the index directly from rubygems instead of from a cloudfront cache. 似乎直接从rubygems而不是从cloudfront缓存获取索引。

I had a look at the index, and there is quite a diffence in the two indexes, so if you just released a gem or use a newly released gem, you might have to add --full-index in order to get the proper index. 我查看了索引,并且两个索引中存在相当大的差异,因此如果您刚刚发布了gem或使用新发布的gem,则可能必须添加--full-index才能获得正确的索引。

Do you have rubygems listed as a remote source? 您是否将rubygems列为远程源?

Your Gemfile should have source :rubygems at the top of the file, and $ gem sources should return at a minimum: 你的Gemfile应该在文件顶部有source :rubygems$ gem sources应该至少返回:

*** CURRENT SOURCES ***

http://rubygems.org/

If it's not listed, you can add it with $ gem sources -a http://rubygems.org 如果没有列出,你可以用$ gem sources -a http://rubygems.org添加它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM