A while ago I was installing NPM and I noticed that when I tried to run their install shell script using sudo it threw errors regarding some commands not being found. However when trying to run the same script without sudo everything worked like a charm.
I'm a new linux user, but from my understanding, sudo's permissions and visilibity are a superset of the normal user.
Why does it happen?