Some time ago, I encountered a problem when installing the NVM management node on the Mac. The problem was that THE NVM installation failed when the Node was already installed on the Mac. The reason was that the Node installed on the Mac should be uninstalled before the NVM installation. This blog post will take the process of uninstalling Node from a Mac as a separate topic, because if node is not uninstalled from a Mac, NVM installation will fail.

Uninstall Mac installed above the known node steps are not complicated, but some unscrupulous online tutorial pit many don’t understand, in order to avoid the unscrupulous online tutorial perpetuated this misunderstanding, in order to facilitate access to use later, this blog to demonstrate the correct unloading node steps, as long as control the corresponding command line operation, To delete a node, perform the following steps:

Open the Mac terminal and enter the following commands in sequence:

Unmount NPM command line

sudo npm uninstall npm -g

Delete folder created by node;

sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* //

Delete folder created by node;

sudo rm -rf /usr/local/include/node /Users/$USER/.npm    

4, delete node command line:

sudo rm /usr/local/bin/node   

5, delete node man command line:

sudo rm /usr/local/share/man/man1/node.1

Delete node file:

sudo rm /usr/local/lib/dtrace/node.d

After more than six command line according to the operating sequence from 1 to 6 after the execution, to verify whether completely uninstall the node, and node created in each folder there are too many, and the distribution is very messy, if think computer not delete clean, you can perform the following two commands to check, and then continue to delete, The specific operation is as follows:

/usr/local = /usr/local = /usr/local = /usr/local

find /usr/local -name ‘npm*’

/usr/local = /usr/local = /usr/local = /usr/local = /usr/local

find /usr/local -name ‘node*’

Note: When deleting files starting with NPM or node, do not delete files starting with NPM or node in other applications.

After uninstalling Node, reboot your Mac, which resets the NPM related commands, and then execute the following command to confirm the complete uninstallation:

1. Run the following command to view NPM:

npm -v

If the Mac terminal displays -bash: NPM: Command not found, the uninstallation is successful

2. Run the view node command:

node -v

If -bash: node: Command not found is displayed on the Mac terminal, the uninstallation is successful

After the above steps, Node is completely unmounted.

 

The above is all the content of this chapter. Welcome to pay attention to the wechat public account of Sanzhan “iOS development by Sanzhan”, and the Sina Weibo account of Sanzhan “Sanzhan 666”, welcome to pay attention to it!