I just installed node and npm through the package on nodejs.org and whenever I try to search or install something with npm it throws the following error, unless I sudo the c
Changing the owner on "system-global" folders is a hack. On a fresh install, I would configure NPM to use an already writable location for "user-global" programs:
npm config set prefix ~/npm
Then make sure you add that folder to your path:
export PATH="$PATH:$HOME/npm/bin"
See @ErikAndreas' answer to NPM modules won't install globally without sudo
and longer step-by-step guide by @sindresorhus with also sets $MANPATH
.