sudo bundle导致`找不到bundler`错误

时间:2015-10-26 04:54:56

标签: ruby gem bundle

bundle exec工作正常,但当我尝试执行sudo bundle exec时,我遇到Could not find 'bundler' (>= 0)错误。

这是完整的错误消息。

smcho@macho appname> sudo bundle exec unicorn -c config/unicorn.rb -E production -D
/Users/smcho/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'bundler' (>= 0) among 11 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/Users/smcho/.gem/ruby/2.2.0:/Users/smcho/.rvm/rubies/ruby-2.2.3/lib/ruby/gems/2.2.0', execute `gem env` for more information
    from /Users/smcho/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/dependency.rb:324:in `to_spec'
    from /Users/smcho/.rvm/rubies/ruby-2.2.3/lib/ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /Users/smcho/.rvm/gems/ruby-2.2.3/bin/bundle:22:in `<main>'
    from /Users/smcho/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
    from /Users/smcho/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'

我发现了许多与此问题相关的问题/答案,但似乎没有任何效果。

1 个答案:

答案 0 :(得分:2)

要使用bundle命令,您需要先安装bundler

sudo gem install bundler

然后您就可以使用bundle命令:

sudo bundle exec . . .

结帐bundler official page了解详情。