Home > Web Front-end > JS Tutorial > body text

How to completely uninstall node and npm on Mac

php中世界最好的语言
Release: 2018-05-29 11:46:00
Original
2880 people have browsed it

This time I will show you how to completely uninstall node and npm in Mac. What are the precautions? Here are actual cases, let’s take a look.

Using nvm to manage node versions is very convenient. You can switch between different versions freely, but nvminstalls The node is under ~/.nvm, which is the same as the one installed before We are not together, and I have a bit of obsessive-compulsive disorder, so I want to uninstall the previous one

homebrew installed

directly command

brew uninstall node
Copy after login

Official website to download the pkg installation package

One command

sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
Copy after login

Installation by other ways

Make a script to put the needsDelete files, kill them all in one stroke

The content is as follows, named: 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.*
Copy after login

Modify file permissions chmod 777 uninstallNodejs.sh

Execute on the command line

Tips:

After deleting these things, the node will be deleted.

But there are a lot of software and command line tools installed based on node, which also need to be reinstalled, such as react-native, supervisor, pm2 etc

Need to delete /usr/local/bin The following related files are actually just soft links, and they are all located in the /usr/local/lib/node_modules/ directory.

In the previous steps, it has been deleted, but you can still find it by pressing the tab key because these soft connections still exist.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to use AngularJS to implement tab switching

How to use Koa2 to develop WeChat 2D Scan the QR code to pay

The above is the detailed content of How to completely uninstall node and npm on Mac. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!