Problem scenario
You run “sudo npm” or “sudo node” and you get “command not found” error messages. What should you do?
Solution
Modify the /etc/sudoers file. Find the stanza with secure_path. Append “:/usr/local/bin” (with no quotes) to the line.
Here is an example of how the stanza should look (it is often on line 80 of /etc/sudoers):
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
Once the /etc/sudoers file has been saved,
…
Continue reading “How Do You Use “sudo npm” or “sudo node” Commands?”