Mac Instructions
Step 1:
Open terminal and change to the root directory by typing...
cd /
Then change the directory to following by typing...
cd /usr/local/lib
Step 2:
Type the following to list files and folders in the directory...
ls
Then look in the list of files/folders for one that is named “node” or “node_modules”.
Step 3:
First open up the permissions to allow deleting all the files
chmod -R 777 /usr/local/lib/node_modules
Type the following based on what is present in the list...
sudo rm –r node
Or
sudo rm –r node_modules
Step 4:
Type the following to return to your root directory...
cd /
Then change the directory to following by typing...
cd /usr/local/include
Step 5:
Type the following to list files and folders in the directory...
ls
Look through the files/folders for one that is named “node” or “node_modules”.
Step 6:
Type the following based on what is present in the list...
sudo rm –r node
Or
sudo rm –r node_modules
Step 7:
Type the following to return to your root directory...
cd /
Then change the directory to following by typing...
cd /usr/local/share/man/man1
Step 8:
Let's remove anything related to node by typing...
sudo rm node*
Then let’s remove anything related to npm by typing....
sudo rm npm*
Step 9:
Change to the root directory by typing...
cd /
Then change the directory to following by typing...
cd /usr/local/share/systemtap/tapset/
Step 10:
Remove the node.stp file by typing the following...
sudo rm node.stp
Step 11:
Change to the root directory by typing...
cd /
Then change the directory to following by typing...
cd /usr/local/share/doc
Step 12:
Remove the node folder here by typing...
sudo rm –r node
Step 13:
Change to the root directory by typing...
cd /
Then change the directory to following by typing...
cd /usr/local/bin
Step 14:
Let remove the important existing node files by typing to following...
sudo rm node npm npx node-debug node-gyp
Step 15:
Change to the root directory by typing...
cd /
Then change the directory to following by typing...
cd /usr/local/lib/dtrace
Step 16:
Remove the node.d file by typing the following...
sudo rm node.d
Step 17:
cd $HOME
sudo rm -R .npm
This will delete the local (non-global) npm files in your user account home directory.
Step 18:
If you type...
node –v
The node command will not be found by the OS. This confirms that node was removed from the system.
Advanced:
If after a re-installation of node one still receives errors then try the following (advanced users only):
sudo chmod -R 777 /usr/local/lib/node_modules
sudo chmod -R 777 /usr/local/bin
cd $HOME
for package in `ls node_modules`; do npm uninstall $package; done;
sudo rm -Rf .npm
sudo rm -rf .node-gyp
sudo rm -f package-lock.json
sudo rm -f package.json
cd /usr/local/lib
for package in `ls node_modules`; do npm uninstall $package; done;
sudo rm -rf /usr/local/bin/npm /usr/local/bin/node
sudo rm -rf /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp
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
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
sudo rm -rf /usr/local/n
This should remove all remnants of the node installation.
Windows Instructions
Step 1:
In your windows search bar look for “cmd”.
Then right click it and run as administrator.
Step 2:
In the command prompt type, the following...
npm cache clean --force
Step 3:
In the windows search look for “add or remove programs”.
Then search “node” in the search bar and click uninstall.
Step 4:
Reboot your PC to stop any possible node processes still running.
Step 5:
In your file explorer search for the path...
C:\Program Files (x86)
If there is a folder named “Nodejs”, delete it.
Step 6:
In your file explorer search for the path...
C:\Program Files
If there is a folder named “Nodejs”, delete it.
Step 7:
In your file explorer search for the path...
C:\Users\yourUser\AppData\Roaming
If there is a folder named “npm” or “npm-cache” delete them.
Step 8:
In your file explorer search for the path...
C:\Users\yourUser\.npmrc
If there is a file named “.npmrc” delete it.
Step 9:
In your file explorer search for the path...
C:\Users\{User}\AppData\Local\Temp
If there are any folders named with “npm-” delete them.
Step 10:
In the windows search bar look for “edit environment variables”.
Click on the “path” variables.
Step 11:
Remove any variable that contains “Nodejs” or “npm”.
When done click the ok button.
Step 12:
Reboot the PC for good measure.
Step 13:
Open the command prompt and type the following...
node –v
If you get an error where node is not recognized, then Node.js is uninstalled.