prosseek
prosseek

Reputation: 190749

sudo bundle causes `could not find bundler` error

I have bundle exec works fine, but when I'm trying to execute sudo bundle exec, I have Could not find 'bundler' (>= 0) error.

This is the full error message.

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>'

I found many questions/answers related to this issue, but nothing seems to work.

Upvotes: 0

Views: 1793

Answers (1)

K M Rakibul Islam
K M Rakibul Islam

Reputation: 34328

In order to use bundle command, you need to install bundler first:

sudo gem install bundler

Then you will be able to use bundle command:

sudo bundle exec . . .

Checkout bundler official page for more information.

Upvotes: 2

Related Questions