I'm trying to get set up with npm and nodejs on ubuntu server but noticed that somehow I ended up with two versions after running
sudo apt-get install nodejs npm
sudo npm -v
For some Linux distributions (Debian/Ubuntu and RedHat/CentOS), the latest node version provided by the distribution may lag behind the stable version. Here are instructions from NodeSource on getting the latest node.
Then you can install the latest
npm by running
sudo npm i -g npm@latest.