Ubuntu – how to remove complete node js and npm from Ubuntu 18.04

nodejsnpm

although I try with all nodejs uninstall command, still node version and npm version is showing when I run npm -v
I run followingh commands:

sudo apt-get remove nodejs

sudo apt-get remove npm
sudo apt-get update



sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node /opt/local/include/node /opt/local/lib/node_modules 

sudo rm -rf /usr/local/lib/node*

sudo rm -rf /usr/local/include/node*

sudo rm -rf /usr/local/bin/node*

List item

Best Answer

You can try running apt-get remove nodejs --purge and apt-get remove npm --purge.

If the command continues to run, you can run find / -name npm, check the results, and delete files that you consider necessary.

Related Question