Fix "Cannot find module 'semver'" Error When Using Ubuntu

When running npm install, I always get a Cannot find module ‘semver’ error. The environment I was using was Ubuntu 14.04 at Cloud9 (c9.io). To fix that error, I did the following:

sudo apt-get remove nodejs
sudo apt-get remove npm
sudo rm -rf ~/.npm
sudo rm -rf /usr/local/lib/node_modules
curl -0 -L https://npmjs.org/install.sh | sudo sh