捆绑安装找不到 gem "bundler" 的兼容版本
Bundle install could not find compatible versions for gem "bundler"
当我键入 bundle install 时出现此错误。我试图找到解决方案,但没有解决我的案子。请帮助我。
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 4.1.8) was resolved to 4.1.8, which depends on
bundler (< 2.0, >= 1.3.0)
Current Bundler version:
bundler (2.0.1)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Could not find gem 'bundler (< 2.0, >= 1.3.0)', which is required by gem 'rails
(= 4.1.8)', in any of the sources.
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (= 4.1.8)
animate-rails was resolved to 1.0.10, which depends on
rails
您的捆绑器 gem 太大了。您现在可以通过更改 gem 文件以指定较低版本并再次删除锁定文件来降级。
gem 'bundler', '1.17.1'
然后在终端中尝试这些命令
gem install bundler -v 1.17.1
gem uninstall bundler -v 2.0.1
bundle update --bundler
bundle install
最后一个安装命令可能是多余的。我在 phone 上,所以很遗憾我无法测试任何东西。
祝你好运!
编辑:
现在这是一个 Heroku 问题。知道了。关于 Bundler
的 Heroku 文档
Libraries
The following libraries are used by the platform for managing and running >Ruby applications and cannot be specified. For application dependency resolution and management, bundler is installed based on the contents of your Gemfile.lock. If you have a BUNDLED WITH in your Gemfile.lock then you will receive a different version of Bundler:
在 Gemfile.lock 中指定 Bundler 2.x 的应用程序将收到 bundler:2.0.1
在 Gemfile.lock 中指定 Bundler 1.x 的应用程序将收到 bundler: 1.15.2
Gemfile.lock 中没有 BUNDLED WITH 的应用程序将默认为 bundler: 1.15.2
有关可用设置的更多信息,请参阅 Bundler 配置。有关为什么我们只支持一组特定的捆绑器版本的更多信息,请参阅这篇关于您的捆绑器版本的文章。
所以好像Heroku只允许某些版本的Bundler兼容,相关文档已链接。降级到 1.15.2 并再试一次。
尝试使用
gem install bundler -v 1.17.3
bundle _1.17.3_ install
您不需要卸载最新版本的捆绑器(尤其是当您有其他应用程序时)。
首先找到您需要的捆绑器版本。
例如 运行 bundle install
之后:
Could not find gem 'bundler (>= 1.3.0, < 2.0)', which is required by gem 'rails (~> 4.2)', in any of the sources.
我需要 1.3.0 和 2.0 之间的任何版本。因此,我会选择 bundler 1.9。
然后,安装捆绑器:
gem install bundler -v 1.9
运行 安装 gems 的捆绑器版本:
bundler _1.9_ install
当我键入 bundle install 时出现此错误。我试图找到解决方案,但没有解决我的案子。请帮助我。
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 4.1.8) was resolved to 4.1.8, which depends on
bundler (< 2.0, >= 1.3.0)
Current Bundler version:
bundler (2.0.1)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Could not find gem 'bundler (< 2.0, >= 1.3.0)', which is required by gem 'rails
(= 4.1.8)', in any of the sources.
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails (= 4.1.8)
animate-rails was resolved to 1.0.10, which depends on
rails
您的捆绑器 gem 太大了。您现在可以通过更改 gem 文件以指定较低版本并再次删除锁定文件来降级。
gem 'bundler', '1.17.1'
然后在终端中尝试这些命令
gem install bundler -v 1.17.1
gem uninstall bundler -v 2.0.1
bundle update --bundler
bundle install
最后一个安装命令可能是多余的。我在 phone 上,所以很遗憾我无法测试任何东西。
祝你好运!
编辑:
现在这是一个 Heroku 问题。知道了。关于 Bundler
的 Heroku 文档Libraries The following libraries are used by the platform for managing and running >Ruby applications and cannot be specified. For application dependency resolution and management, bundler is installed based on the contents of your Gemfile.lock. If you have a BUNDLED WITH in your Gemfile.lock then you will receive a different version of Bundler:
在 Gemfile.lock 中指定 Bundler 2.x 的应用程序将收到 bundler:2.0.1 在 Gemfile.lock 中指定 Bundler 1.x 的应用程序将收到 bundler: 1.15.2 Gemfile.lock 中没有 BUNDLED WITH 的应用程序将默认为 bundler: 1.15.2 有关可用设置的更多信息,请参阅 Bundler 配置。有关为什么我们只支持一组特定的捆绑器版本的更多信息,请参阅这篇关于您的捆绑器版本的文章。
所以好像Heroku只允许某些版本的Bundler兼容,相关文档已链接。降级到 1.15.2 并再试一次。
尝试使用
gem install bundler -v 1.17.3
bundle _1.17.3_ install
您不需要卸载最新版本的捆绑器(尤其是当您有其他应用程序时)。
首先找到您需要的捆绑器版本。
例如 运行 bundle install
之后:
Could not find gem 'bundler (>= 1.3.0, < 2.0)', which is required by gem 'rails (~> 4.2)', in any of the sources.
我需要 1.3.0 和 2.0 之间的任何版本。因此,我会选择 bundler 1.9。
然后,安装捆绑器:
gem install bundler -v 1.9
运行 安装 gems 的捆绑器版本:
bundler _1.9_ install