I have already solved this problem but I do not know why this solves the problem and I don't like not knowing what went wrong. I'm using the terminal on Ubuntu
Here was the issue...
If I run $ ngm -args
it runs but fails because it requires sudo
If I run $ sudo ngm -args
I get the error like ngm not found
If I run $ sudo /usr/local/lib/ngm -args
it runs with sudo and works perfectly.
I don't understand why the 3 works and 2 doesn't work.
When trying to run $ ngm -args
, the shell will look for the executable in it's $PATH
variable, and it finds it. When trying to run the executable it finds that it has to be sudo
and exits.
When you run $ sudo ngm -args
, the shell will look for the executable in the $PATH
environment of the Root user, and it can't find it.
When running it like the last option, the shell doesn't need to look in the $PATH
of the root user, because it finds it in the path that you specified /usr/local/lib/ngm
, so both issues are gone.
This might be a starting point in order to understand the PATH