Capistrano says, "sh: bundle: not found"

By: Johnathon Wright on: May 12, 2011

Typically, you define your path in /etc/environment. Here's a simple example:


PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/ruby/bin"

That last bit tells the system where Ruby lives. If Ruby isn't in the path, you won't be able to run it or any gem scripts, like bundle.

Unfortunately, neither /etc/environment nor /etc/profile is respected under certain situations, like the way Capistrano works by default.

The solution for me was to edit /etc/bash.bashrc, adding this as the first line:


source /etc/environment

Note: Adding it as the first line allows / encourages it to be overwritten as needed. If you're still having problems, here's one way to get started with troubleshooting:

edit /etc/bash.bashrc to include this

export USES_BASHRC='bashrc'

edit /etc/profile to include this line:

export USES_PROFILE = 'profile'

then see whether either of those environmental variables is around when capistrano connects. From your dev machine, run "cap shell" and you will end up with a "cap>" prompt. type "echo $USESBASHRC && echo $USESPROFILE. Here's what I got:


cap> echo $USESBASHRC && echo $USESPROFILE [establishing connection(s) to www.verdacom.com] Password: ** [out :: www.verdacom.com] bashrc

** [out :: www.verdacom.com]

Thanks to the SliceHost support team for pointing me in the right direction on this one.

REFERENCES

http://stefaanlippens.net/bashrcandothers



Back