我正在执行以下脚本:
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
添加到我的路径,所以我能够安装 gem。
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
显示已安装的 gem。
我还可以在表演时找到 bundle:
ls -ltrah /srv/myuser/.gem/ruby/2.5.0/bin
我也试过安装 bundler,但也没有帮助。 我做错了什么?
gem which bundle
什么都没显示,gem spec bundle
显示了。
更新: 我试图在运行 bundle 之前安装 bundler,但是同样的问题出现了:
gem list bundle
显示
bundle (0.0.1)
bundler (2.0.1)