Uninstall Node.Js Using Linux Command Line

Uninstall Node.JS using Linux command line?

Edit: If you know which package manager was used to install, it is best to uninstall with the same package manager. Examples for apt, make, yum are in other answers.

This is a manual approach:

Running which node will return something like /path/bin/node.

Then run cd /path

This is all that is added by Node.JS.

rm -r bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node.1

Now the only thing I don't know about is npm and what it has installed. If you install npm again into a custom path that starts off empty, then you can see what it adds and then you will be able to make a list for npm similar to the above list I made for node.

How can I completely uninstall nodejs, npm and node in Ubuntu


sudo apt-get remove nodejs
sudo apt-get remove npm

Then go to /etc/apt/sources.list.d and remove any node list if you have. Then do a

sudo apt-get update

Check for any .npm or .node folder in your home folder and delete those.

If you type

which node

you can see the location of the node. Try which nodejs and which npm too.

I would recommend installing node using Node Version Manager(NVM). That saved a lot of headache for me. You can install nodejs and npm without sudo using nvm.

How to completely remove node.js from Windows

How to remove Node.js from Windows:


  1. Take a deep breath.

  2. Run npm cache clean --force

  3. Uninstall from Programs & Features with the uninstaller.

  4. Reboot (or you probably can get away with killing all node-related processes from Task Manager).

  5. Look for these folders and remove them (and their contents) if any still exist. Depending on the version you installed, UAC settings, and CPU architecture, these may or may not exist:

  • C:\Program Files (x86)\Nodejs
  • C:\Program Files\Nodejs
  • C:\Users\{User}\AppData\Roaming\npm (or %appdata%\npm)
  • C:\Users\{User}\AppData\Roaming\npm-cache (or %appdata%\npm-cache)
  • C:\Users\{User}\.npmrc (and possibly check for that without the . prefix too)
  • C:\Users\{User}\AppData\Local\Temp\npm-*

  1. Check your %PATH% environment variable to ensure no references to Nodejs or npm exist.

  2. If it's still not uninstalled, type where node at the command prompt and you'll see where it resides -- delete that (and probably the parent directory) too.

  3. Reboot, for good measure.

How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X)

Apparently, there was a /Users/myusername/local folder that contained a include with node and lib with node and node_modules. How and why this was created instead of in my /usr/local folder, I do not know.

Deleting these local references fixed the phantom v0.6.1-pre. If anyone has an explanation, I'll choose that as the correct answer.

EDIT:

You may need to do the additional instructions as well:

sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}

which is the equivalent of (same as above)...

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

or (same as above) broken down...

To completely uninstall node + npm is to do the following:

  1. go to /usr/local/lib and delete any node and node_modules
  2. go to /usr/local/include and delete any node and node_modules directory
  3. if you installed with brew install node, then run brew uninstall node in your terminal
  4. check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
  5. go to /usr/local/bin and delete any node executable

You may also need to do:

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

Additionally, NVM modifies the PATH variable in $HOME/.bashrc, which must be reverted manually.

Then download nvm and follow the instructions to install node. The latest versions of node come with npm, I believe, but you can also reinstall that as well.

How to uninstall n and all node versions installed by n

You need to manually remove Node versions installed by n and set the correct Node system version.

sudo n prune
sudo npm uninstall -g n
sudo rm -r /usr/local/n
sudo rm /usr/local/bin/node

See the following issues for n on GitHub:

  • Cant uninstall n and node #327
  • Simple command to switch back to the system installation of Node #486

Uninstalling the currently active version of node.js with nvm

First type

$ nvm deactivate

Then type

$ nvm uninstall 8.8.1

How can I delete NodeJS in ubuntu 20.4?

You have to try the following steps

  • npm cache clean -f
  • npm install -g n
  • sudo n [version]

the version that you want



Related Topics



Leave a reply



Submit