Recently I noticed that a modified $PATH variable – even system-wide by scripts like
export PATH=add_to_path:$PATH
in /etc/profile.d – is not preserved when doing sudo, giving a familiar
sudo: (...) command not found
error message. As discussed here, the reasoning behind this are security measures. A convenient temporary work-around is to set the PATH variable when calling sudo
sudo env PATH=$PATH YOUR_COMMAND
This will give sudo the same PATH environment variable as the calling user.