I'm on Mac Mojave 10.14.6. I develop Node applications and I mistakenly did a sudo npm install for a project I worked on. It was a bad idea because then all Node scripts needed to be run as sudo.

At that time Node was installed in /usr/local...[bin/lib, etc...]

I ran this script to fix the problem:

sudo chown -R $(whoami) ~/.npm

But I think it made matters worse. So I deleted all node-related files and folders and reinstalled using NVM (which installs to my Home directory which I own). However, I still am unable to run a script unless I use sudo.

Did I screw up my Mac permissioning? How can I revert it?

  • If you try to run node file.js (given that file.js is valid code), what output do you get? – haykam Nov 20 '19 at 1:33

You must log in to answer this question.

Browse other questions tagged .