在 rhel8 上,我构建并安装了一个自定义 gem test1
。
$ gem build test1.gemspec
Successfully built RubyGem
Name: test1
Version: 0.0.1
File: test1-0.0.1.gem
$ gem install test1-0.0.1.gem
Successfully installed test1-0.0.1
1 gem installed
# check if gem is installed. All gems are installed in this path
$ gem which test1
/usr/local/share/gems/gems/test1-0.0.1/lib/test1.rb
现在在我构建的另一个自定义 gem 中,gemspec 文件如下所示:
# in test2.gemspec file
Gem::Specification.new do |spec|
spec.name = "test2"
...
spec.add_runtime_dependency "test1", "0.0.1"
...
end
当我尝试安装 test2 gem 时,它失败并说找不到已安装的 test1 gem。这个问题开始发生在 rhel8 上。我在 debian 和 alpine 上进行了测试,发现和安装 gem 没有问题。
$ gem build test2.gemspec
Successfully built RubyGem
Name: test2
Version: 0.0.1
File: test2-0.0.1.gem
$ gem install test2-0.0.1.gem
ERROR: Could not find a valid gem 'test1' (= 0.0.1) in any repository
如果我更改为add_development_dependency
,它将构建并安装 gem。图像按预期工作,没有问题。有谁知道为什么我添加时它无法找到宝石add_runtime_dependency
?