With the NVM node version of the management, or is very convenient, each version of the switch freely, but the NVM installation of node is ~/.nvm
under, and before the installation of not together, a bit obsessive-compulsive I, I want to uninstall the previous
Homebrew installation of
A direct command.
brew uninstall node
Download PKG installation package on official website
a command
sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
Other path-installed
Make a script, put the files that need to be deleted, a shuttle all kill
The content is as follows, named: uninstallnode.sh
#!/bin/bashlsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read i; do sudo rm /usr/local/${i}donesudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
Modify file Permissions chmod 777 uninstallNodejs.sh
Executing at the command line
Tips:
When these things are erased, node is deleted.
But there are a bunch of software and command-line tools based on node installation that need to be reinstalled, such as react-native, SUPERVISOR,PM2 etc
Need to delete the /usr/local/bin
following related files, in fact, they are just some soft connections, the main is in the /usr/local/lib/node_modules/
directory.
In the previous steps, it has been removed, but the TAB key can be found because these soft links still exist
Completely uninstall node and NPM under Mac