Home >Web Front-end >JS Tutorial >How Do I Completely Uninstall and Reinstall Node.js and npm on macOS to Resolve Persistent Version Conflicts?
Uninstalling and Reinstalling Node.js on Mac OS X
Problem:
You encounter a persistent phantom version of Node.js (v0.6.1-pre) despite installing newer versions using Brew and NVM. You wish to completely remove Node.js, npm, and NVM and reinstall them from the beginning.
Solution:
Locate and Delete Phantom Folders:
Uninstall Node.js via Brew:
Open Terminal and run:
brew uninstall node
Remove NVM Modifications:
Uninstall Node.js and npm (Optional):
Remove any remaining node, node_modules, and npm files from the following locations:
Reinstall Node.js and npm:
Install Node.js using NVM:
nvm install node
Additional Notes:
If necessary, use the following commands to remove additional artifacts:
sudo rm -rf \ /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
After completing the reinstallation, verify the installed versions:
node -v npm -v
The above is the detailed content of How Do I Completely Uninstall and Reinstall Node.js and npm on macOS to Resolve Persistent Version Conflicts?. For more information, please follow other related articles on the PHP Chinese website!