Update your repository if you haven’t done so in a long time
$ sudo apt-get update
Install nodejs
$ sudo apt-get install nodejs
Install npm
$ sudo apt-get install npm
Check if npm installed correctly
$ which npm
/usr/bin/npm
$ npm
You shouldn’t get any error messages and the second command should give you usage instructions.