I have followed the below instructions to install nodejs
Download the .tar.xz
file form https://nodejs.org/en/ and then press Ctrl + Alt + T.
Then go to the destination that you downloaded your file to. For me it's my downloads folder. Then hit this command and Node.js will get installed on your system:
sudo tar -xf node-v16.0.0-linux-x64.tar.xz --directory=/usr/local --strip-components=1
Now, i want to remove node js, so i tried
rahul@rahul:~$ sudo apt-get purge --auto-remove nodejs
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'nodejs' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
rahul@rahul:~$ sudo apt-get purge --auto-remove node
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package node
rahul@rahul:~$ node -v
v14.17.6
rahul@rahul:~$