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
Watch OUT!!! Watch OUT!!! Watch OUT!!!
chown or chmod is NOT the solution, because of security-risk.
Instead do this, do:
First check, where npm point to, if you call:
npm config get prefix
If /usr is returned, you can do the following:
mkdir ~/.npm-global
export NPM_CONFIG_PREFIX=~/.npm-global
export PATH=$PATH:~/.npm-global/bin
This create a npm-Directory in your Home-Directory and point npm
to it.
To got this changes permanent, you have to add the export-command to your .bashrc:
echo -e "export NPM_CONFIG_PREFIX=~/.npm-global\nexport PATH=\$PATH:~/.npm-global/bin" >> ~/.bashrc