0

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

2 Answers2

1

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.

Eliah Kagan
  • 119,820
Ubunter
  • 54
0

To manually remove node js, npm and node_modules from Ubuntu, you need to do the following steps.

  1. First of all you need to run the following command from command terminal as sudo.

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

  1. Remove node or node_modules directories from /usr/local/lib with the help of following command.

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

  1. Remove node or node_modules directories from /usr/local/include with the help of following command.

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

  1. Remove any node file or dir from /usr/local/bin with the help of following command.

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

  1. Go to home directory and remove any node or node_modules directory, if exists.

Now it is done

Silah Kosgei
  • 61
  • 1
  • 1