I have installed rbenv on an Ubuntu sever. I can cd into my application directory and run $ bundle without issue, however I need to run $ sudo bundle exec ... and this gets me an error:
bundle: command not found
Why is this and how can I fix it?
Not entirely sure, but maybe this would work for you:
sudo -i -u $USER bundle exec...
or
sudo -i -u username_with_correct_env bundle exec...
Dan Carley's rbenv-sudo looks like it will do what you want:
rbenv-sudo is a plugin for rbenv that allows you to run rbenv-provided Rubies and Gems from within a sudo session.
A more detailed explanation of how it works is provided in this article: Sudo Rbenv Me a Sandwich
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With