Upgrade Node.JS to Latest LTS Version on Ubuntu And you no need to Remove or Purge the Previously installed LTS Package Just Run the Below commands apt will Handle it.

I upgrade from 8.X to 10.X

curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get update && sudo apt-get install -y nodejs
  • Upgrade npm
sudo npm i -g npm