Completely uninstall node and NPM under Mac

Source: Internet
Author: User

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.*
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.