I've installed some of the software under /opt folder by compiling. I've added their "bin" directory to the path inside "/etc/environment". I can also use them as a regular user. For eg: NodeJS 10.15.1 has been installed in /opt and giving
node -v
outputs v10.15.1
.
Similarly if I run the same with sudo,
sudo node -v
I'm getting sudo: node: command not found
.
If I become root by sudo -s
and then execue node -v
, I'm getting
Command 'node' not found, but can be installed with:
apt install nodejs
The reason I want to use "sudo" is, I've installed "Angular" using "npm". And at certain times, ng serve
not reflecting new code changes automatically (which is default behavior of "ng serve" command).
So as pointed out in this post, I want to run this command with "sudo".
Why can't sudo find the executable when it has been added to "PATH"?
0 Answers