我在发布 gem 时遇到此错误:"Could not find gem 'uix_validations (~> 0.5.0)' in any of the gem sources listed in your Gemfile."

I got this error when I publish my gem: "Could not find gem 'uix_validations (~> 0.5.0)' in any of the gem sources listed in your Gemfile."

我刚刚在 rubygems.org、here is the link 上发布了我的 gem。一切看起来都不错。

但是当我尝试使用 gem 'uix_validations', '~> 0.5.0' 添加到项目时,我在 bundle install 时遇到了这个错误:

Could not find gem 'uix_validations (~> 0.5.0)' in any of the gem sources listed
in your Gemfile

而且我不知道如何解决这个问题。

我使用以下步骤发布:

gem build uix_validations.gemspec

这会生成一个文件:uix_validations-0.5.0.gem

并发布:

gem push uix_validations-0.5.0.gem

您的 Gemfile 中可能没有正确的来源。

在指定 gem 之前,您应该定义 rubygem 的来源。这通常在第一行完成。

例子

source 'https://rubygems.org'

gem 'uix_validations'

我在这里得到了答案:github rubygems

"Your gem has been published but you need to wait for RubyGems.org to refresh it's cache. It should only take a short while."

作者:colby-swandale