If you want to un-install nodejs from your Ubuntu, give following commands:

1. sudo apt-get purge nodejs –auto-remove
2. sudo apt-get purge npm –auto-remove
3. sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}

Install Nodejs:

1. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
2. source ~/.bashrc
3. nvm list-remote
4. nvm install v14.17.4

You can see the different versions you have installed by typing:

nvm list

You can also install by name : nvm install lts/erbium

Compatible NPM will be automatically installed.