Bundler 无法安装 signet

Bundler can't install signet

我刚刚删除了 rbenv,因为我想安装比 rbenv 可用版本更新的 Ruby 版本 (2.6),然后安装了 Ruby 2.6 ,一切顺利,现在在尝试为我的应用程序重新安装所有 gem 时,我 运行 遇到以下问题:

$ bundle install
Installing signet 0.14.0
Gem::InstallError: signet requires Ruby version >= 2.4.0.
An error occurred while installing signet (0.14.0), and Bundler cannot continue.
Make sure that `gem install signet -v '0.14.0' --source 'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  google_drive was resolved to 2.1.12, which depends on
    google-api-client was resolved to 0.21.2, which depends on
      googleauth was resolved to 0.6.7, which depends on
        signet

但是ruby明明已经升级了:

$ ruby -v
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux-gnu]

如果我尝试手动安装 signet,它工作正常:

gem install signet -v '0.14.0' --source 'https://rubygems.org/'
Successfully installed signet-0.14.0
Parsing documentation for signet-0.14.0
Done installing documentation for signet after 0 seconds
1 gem installed

但是如果我再次 运行 bundle install 我仍然遇到同样的问题。我也试过 bundle install --path vendor/cachebundle install --system 都无济于事。

请注意,gem 似乎安装在正确的位置:

gem which signet
/var/lib/gems/2.6.0/gems/signet-0.14.0/lib/signet.rb

如果我将其与捆绑程序安装的另一个进行比较:

gem which multi_json
/var/lib/gems/2.6.0/gems/multi_json-1.14.1/lib/multi_json.rb

这是在 Ubuntu 16.04.4 LTSbundler 1.16.3

我该如何解决这个问题?

所以我终于弄明白了,安装更新版本的捆绑器(但 <2.0,因为 Rails 4.2 需要它)成功了,尽管我还必须卸载 ruby 2.2-dev 包并安装 2.6-dev 包以便能够编译像 nokogiri 这样的原生 gem,然后 运行 指定捆绑器版本的整个过程。

对于那些感兴趣的人,这些是命令:

apt-get remove ruby-dev
apt install ruby2.6-dev
gem install bundler -v 1.17.3
bundle _1.17.3_ install