我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>'
我发现了许多与此问题相关的问题/答案,但似乎没有任何效果。
bundle: command not found
。 $ echo 'echo $PATH' | sh
和$ echo 'echo $PATH' | sudo sh
答案 0 :(得分:2)
要使用bundle
命令,您需要先安装bundler
:
sudo gem install bundler
然后您就可以使用bundle
命令:
sudo bundle exec . . .
结帐bundler official page了解详情。