cri.dev
about posts rss

node and sudo: now kiss

Published on

Getting permission errors when installing a module?

Are ‘sudo: node: command not found’ errors taking away your precious sleeping hours?

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 http://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

adapted from here

Your 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/
now kiss

Here, have a slice of pizza 🍕