bash: command not found

When running a pre or post-deployment SSH command on your server during a deployment, you may run into an error like the following:

bash: tool: command not found

Where tool is the name of the tool you're trying to use. For example, something like Composer.

This can happen as a result of a mismatch in paths. DeployHQ when connecting does so non-interactively (i.e. as a non-human user), which is different from when you connect via your terminal using an interactive (human) connection. This then explains why the command works perfectly fine when you run it directly.

You should check that your user's ~/.bashrc and ~/.bash_profile files contain the same paths so that both connection types can correctly access the tool you're using.

This FAQ also provides further information about the differences between running an interactive or non-interactive session.