Completely uninstall node and NPM on MAC

NVM is installed under ~/. NVM is not installed with the previous one. I am a little obsessive, so I want to uninstall the previous one
Homebrew installed

brew uninstall node
The official website downloads the PKG installation package
A command
sudo rm - rf/usr/local/{bin/{node, NPM}, lib/node_modules/NPM, lib/node, share/man/*/node. *}
It was installed in another way
Make a script, the need to delete the file, a shuttle all kill
It will be called: uninstallNode. sh

#!/bin/bash
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom \
| while read i; do
  sudo rm /usr/local/${i}
done
sudo rm -rf /usr/local/lib/node \
     /usr/local/lib/node_modules \
     /var/db/receipts/org.nodejs.*

Modify file permissions chmod 777 uninstallnodejs.sh
is executed on the command line
When you're done deleting all that stuff, you're done deleting node.
but there are a lot of node-based installed software and command-line tools that need to be reinstalled, such as react-native, supervisor,pm2 etc
need to delete the files under /usr/local/bin, actually they are just soft connections, it's all under /usr/local/lib/node_modules/.
was removed in the previous step, but you can still find it by pressing the TAB key because these soft connections still exist

Read More: