Getting permission errors when installing a module?
Are ‘sudo: node: command not found’ errors taking away your precious sleeping hours?
You have to remove any trace of node on your system, and reinstall it. It will soothe your pain:
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local && ~/node-latest-install && ~/node-latest-install
curl https://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local && make install
curl https://npmjs.org/install.sh | sh
rm -rf ~/node-latest-install
You are one/two steps/commands away from success. Just replace /path/to/your/home/
with the absolute path to your home directory (leaving the rest of the path as is):
sudo ln -s /path.to/your/home/local/bin/node /usr/local/bin/
sudo ln -s /path.to/your/home/local/bin/npm /usr/local/bin/
And now…
Also see: install node and npm without having to sudo
Help us improve this content by editing this page on GitHub