To remove Node.js from a Mac, follow these steps:
Uninstall Node.js using npm:
npm uninstall -g node
Remove the Node.js executable and the npm modules:
rm /usr/local/bin/node
rm -rf /usr/local/lib/node_modules
Remove the Node.js home directory:
rm -rf ~/.npm
Remove the npm and node directories from PATH:
vi ~/.bash_profile
Search for and delete the following lines:
export PATH=$PATH:/usr/local/bin/npm
export PATH=$PATH:/usr/local/bin/node
Save and exit the file.
Restart the terminal or run the following command:
source ~/.bash_profile
This should remove Node.js from your Mac. You can verify the uninstallation by running the following command:
node -v
If Node.js is uninstalled, you should see an error message saying that the command is not found.
Remove NVM from MacOS
To remove nvm (Node Version Manager) from your Mac, follow these steps:
Remove the nvm installation directory:
rm -rf ~/.nvm
Remove the nvm configuration from your shell profile:
vi ~/.bash_profile
Search for and delete the following lines:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Save and exit the file.
Restart the terminal or run the following command:
source ~/.bash_profile
This should remove nvm from your Mac. You can verify the uninstallation by running the following command:
nvm -v
If nvm is uninstalled, you should see an error message saying that the command is not found.
Top comments (0)