当我运行bundle install
时,出现以下错误。就像我运行bundle -v
/Library/Ruby/Site/2.0.0/rubygems/dependency.rb:318:in `to_specs': Could not find 'bundler' (>= 0) among 13 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/john/.gem/ruby/2.0.0:/Library/Ruby/Gems/2.0.0:/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0', execute `gem env` for more information
from /Library/Ruby/Site/2.0.0/rubygems/dependency.rb:327:in `to_spec'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
from /usr/local/bin/bundle:22:in `<main>'
这是我的红宝石宝石环境
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.4
- RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /Users/john/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/john/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/john/.rbenv/versions/2.3.1/bin/ruby
- EXECUTABLE DIRECTORY: /Users/john/.rbenv/versions/2.3.1/bin
- SPEC CACHE DIRECTORY: /Users/john/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/john/.rbenv/versions/2.3.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/john/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
- /Users/john/.gem/ruby/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/john/.rbenv/versions/2.3.1/bin
- /usr/local/Cellar/rbenv/0.4.0/libexec
- /usr/local/bin
- /usr/local/sbin
- /Users/john/.rbenv/shims
- /Users/john/.rbenv/bin
- /usr/bin
- /usr/local/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
以下是which bundler
/usr/local/bin/bundler
答案 0 :(得分:1)
原来$ PATH设置不正确,bin位于rbenv前面。所以它选择了错误的捆绑器。现在是路径:
/Users/john/.rbenv/shims:/Users/john/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
在本地/ bin前面的.rbenv都很好