如何将安装gefile与特定版本的bundler捆绑在一起 [英] How to bundle install gemfile with specific version of bundler
本文介绍了如何将安装gefile与特定版本的bundler捆绑在一起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
gem 'rails', '4.2.0'
的项目。
运行Bundle install
,我得到:
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 4.2.0) was resolved to 4.2.0, which depends on
bundler (>= 1.3.0, < 2.0)
Current Bundler version:
bundler (2.1.4)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Could not find gem 'bundler (>= 1.3.0, < 2.0)', which is required by gem 'rails (= 4.2.0)', in any of the sources.
因此,我尝试安装bundler v1.3.0以成功捆绑此gefile:gem install bundler -v 1.3.0
gem list bundler shows me that I successfully installed bundler at v 1.3.0
然后,当尝试将安装与v1.3.0捆绑在一起时bundle _1.3.0_ install
,得到Could not find command "_1.3.0_".
如何使用特定版本Bundler成功运行捆绑包安装程序?
推荐答案
基本上需要:
- 您的本地计算机上安装了bundler(>=1.3.0,<;2.0)。
- 能够运行该捆绑程序版本。
- 运行捆绑程序版本以安装您应用程序所需的其他gem(捆绑包安装)。
首先,检查您的本机是否已成功安装bundler(>=1.3.0,<;2.0):
$ gem list bundler
您应该看到:
*** LOCAL GEMS ***
bundler (2.1.4, 1.17.3, 1.3.0)
如果没有,请安装:
$ gem install bundler -v "<2" -N
# Install lasted bundler below version 2
# -N: No document
其次,检查是否可以运行捆绑程序版本:
$ bundle _1.17.3_ -v
您应该看到:
Bundler version 1.17.3
如果您安装了bundler 1.17.3,但不能运行"Bundle1.17.3-v",则说明您的RubyGems gem有问题。检查您是否安装了更新版本(最新为3.1.3):
$ gem -v
尝试更新RubyGems gem,因为它可以帮助您运行特定的gem版本:
$ gem update --system
您应该看到:
Updating rubygems-update
...
Installing RubyGems 3.1.3
Successfully built RubyGem
Name: bundler
Version: 2.1.4
File: bundler-2.1.4.gem
Bundler 2.1.4 installed
RubyGems 3.1.3 installed
Regenerating binstubs
...
------------------------------------------------------------------------------
RubyGems installed the following executables:
/home/lqt/.rbenv/versions/2.7.1/bin/gem
/home/lqt/.rbenv/versions/2.7.1/bin/bundle
...
RubyGems system software updated
再次检查是否可以运行特定的捆绑包版本:
$ bundle _1.17.3_ -v
如果您看到:
Bundler version 1.17.3
然后,在第三步,只需运行bundler 1.17.3安装其他gem:
$ bundle _1.17.3_ install
这篇关于如何将安装gefile与特定版本的bundler捆绑在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文