问题描述
我正在执行以下脚本:
gem install rdoc --no-document
gem install bundle
bundle
输出:
+ gem install rdoc --no-document
Successfully installed rdoc-6.1.1
1 gem installed
+ gem install bundle
Successfully installed bundle-0.0.1
Parsing documentation for bundle-0.0.1
Done installing documentation for bundle after 2 seconds
1 gem installed
1 gem installed
+ bundle install
/usr/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
from /usr/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
from /srv/myuser/.gem/ruby/2.5.0/bin/bundle:23:in `<main>'
我已将/srv/myuser/.gem/ruby/2.5.0/bin
添加到我的路径中,以便能够安装gems.
I've added /srv/myuser/.gem/ruby/2.5.0/bin
to my path so I was able to install gems.
gem env
显示
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.7
- RUBY VERSION: 2.5.1 (2018-03-29 patchlevel 57) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/2.5.0
- USER INSTALLATION DIRECTORY: /srv/myuser/.gem/ruby/2.5.0
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /srv/myuser/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib/ruby/gems/2.5.0
- /srv/myuser/.gem/ruby/2.5.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--user-install"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
宝石列表
显示已安装的宝石.我在执行时也可以找到捆绑软件:
gem list
shows the installed gems.I can also find bundle when I perform:
ls -ltrah /srv/myuser/.gem/ruby/2.5.0/bin
我也尝试安装捆绑软件,但这也无济于事.我在做什么错了?
I've also tried to install bundler but that didn't also help.What am I doing wrong?
gem捆绑包
没有显示任何内容. gem spec捆绑包
没有显示它.
gem which bundle
is showing nothing.gem spec bundle
is showing it.
更新:我在运行捆绑软件之前尝试安装捆绑软件,但在以下时间出现相同的问题:
Update: I tried to install bundler before running bundle but the same issue appears while:
宝石列表包
显示
bundle (0.0.1)
bundler (2.0.1)
推荐答案
Bundler版本2引入了一项新功能,可以自动使用项目的 Gemfile.lock
中指定的Bundler版本.因此,如果您现有的 Gemfile.lock
在底部有这样的行
Bundler version 2 introduced a new feature to automatically use the version of Bundler specified in the Gemfile.lock
of your project. Thus, if you have an existing Gemfile.lock
with a line like this at the bottom
BUNDLED WITH
1.17.3
Bundler将尝试使用Bundler版本<2.0.由于您仅安装了Bundler 2.0.1(并且Rubygems> = 2.7.0),因此失败,并显示此无用的错误消息.
Bundler will try to run with a Bundler version < 2.0. Since you just have Bundler 2.0.1 (and Rubygems >= 2.7.0) installed, this fails with this rather unhelpful error message.
要解决此问题,您可以
- 从
Gemfile.lock
中删除行,然后从现在开始在各处使用bundler 2.x,或者 - 使用
gem install bundler -v'<安装bundler 1.x版本.2.0'
以使用您的Gemfile.lock
指定的适当版本.
- remove the lines from your
Gemfile.lock
and to use bundler 2.x everywhere from now on, or - install a bundler 1.x version with
gem install bundler -v '< 2.0'
to use the appropriate version as specified by yourGemfile.lock
.
有关此问题的更多信息,请参见 Bundler博客.
More information about this can be found on the Bundler blog.
这篇关于Bundler:在与gem捆绑安装期间,无法找到具有可执行捆绑(Gem :: GemNotFoundException)的gem bundler(& gt; = 0.a)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!