Skip to main content

Ubuntu 22: Removing Existing Node.js

Ubuntu 22 comes with an existing version of node.js, v12, that is difficult to upgrade.

This is because the libnode-dev package is holding onto it, and we must release it, first.

Removing Conflicting Versions

Run these to remove the conflicting package:

sudo apt-get remove libnode-dev

sudo apt-get update

Now, you can remove old versions of node.js:

sudo apt remove nodejs
cd /etc/apt/sources.list.d 
sudo rm nodesource.list
sudo apt --fix-broken install
sudo apt update
sudo apt remove nodejs
sudo apt remove nodejs-doc