complite nodejs remove ubuntu

  1. Open Terminal on your Ubuntu system using Ctrl + Alt + T or by searching for it in the Applications menu.

  2. Remove the Node.js package using the APT package manager by entering the following command: bash sudo apt-get purge nodejs

  3. Additionally, remove the npm package manager with the command: bash sudo apt-get purge npm

  4. After removing the packages, clear the APT cache to free up disk space: bash sudo apt-get clean

  5. Confirm that Node.js and npm have been uninstalled by checking their versions. If there's no output, it means they are successfully removed: bash node -v npm -v

  6. You might also want to delete any remaining configuration files related to Node.js or npm: bash sudo rm -rf ~/.npm sudo rm -rf ~/.node-gyp

  7. Lastly, to ensure a clean removal, reboot your system: bash sudo reboot