Cannot find module 'semver' unter Ubuntu beheben

When running npm install in an Ubuntu environment, I always got the following error:

Cannot find module 'semver'

To fix that problem, I had to run the following commands:

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