title: execute bundle exec command with sudo
body: <p>If I run the below command, it is working correctly in my staging server.</p>
  
  <pre><code>/bin/bash -l -c 'cd /path/to/app &amp;&amp; sudo bundle exec rails console production lib/myfile.rb'
  </code></pre>
  
  <p>But the same command is not working in production server.</p>
  
  <p>I am getting error:</p>
  
  <pre><code>sudo: bundle: command not found
  </code></pre>
  
  <p>but if I run the same command without sudo it is working correctly.</p>
  
  <p>Please help me to understand why this is happening in production server.</p>