Command not found on AWS EC2 when npm

If you are on a AWS EC2 instance and you're trying to install some package using npm:

sudo npm install -g nodemon

And see the following error:

sudo: npm: command not found

That's because npm is not mapped globaly so we have to add a simbolic link to fix this problem and be able to use npm with sudo:

sudo ln -s /usr/local/bin/npm /usr/bin/npm

source