MacOS : How To Uninstall Node JS and NPM?

Are you facing any issues while running the Node JS or Node Package Manager (NPM) on your MacOS device? Do you want to completely uninstall Node JS and NPM from your MacOS device? If yes, then you have come to the right place. In this article, I will guide you through a step-by-step process of…

By.

min read

Are you facing any issues while running the Node JS or Node Package Manager (NPM) on your MacOS device? Do you want to completely uninstall Node JS and NPM from your MacOS device? If yes, then you have come to the right place.

In this article, I will guide you through a step-by-step process of how to uninstall Node JS and NPM from MacOS using the terminal. By following these steps, you can easily remove Node JS and NPM from your device and free up space on your system.

 

Step 1: Check the Node JS Version

Before proceeding with the uninstallation process, you need to check the version of Node JS installed on your device. To check the Node JS version, open the terminal and enter the following command:

node -v

This command will display the version of Node JS installed on your device.

 

Step 2: Open Terminal and Go to Root Directory

To begin the uninstallation process, open the terminal on your MacOS device. You can do this by searching for “Terminal” in the Launchpad or by pressing the Command+Space keys and typing “Terminal”.

Once the terminal is open, enter the following command to know your current directory:

pwd

This command will display the current directory in which you are working.

Next, go to your root directory by entering the following command:

cd /

Step 3: Go to Node JS Directory

After going to the root directory, enter the following command to go to the usr directory:

cd usr

Then, enter into the local directory by entering the following command:

cd local

Now, enter into the include folder by entering the following command:

cd include

If you enter the ls command, you will see the node folder inside the include folder.

ls
node

To completely uninstall Node JS from MacOS, you need to remove this node folder. Enter the following command to remove the node folder:

sudo rm -R node

Step 4: Remove Node Modules

In the next step, you need to completely remove the node_modules folder from your system. To do this, follow the below steps:

Enter the following command to go back to the previous folder:

cd ..

Enter the following command to go to the lib directory:

cd lib

Enter the following command to remove the node_modules (NPM) folder:

sudo rm -R node_modules

Enter the following command to come out from the directory:

cd ..

Go to the bin folder using the following command:

cd bin

Enter the following command to remove the node folder to completely uninstall Node JS from MacOS:

sudo rm -R node

Step 5: Verify Uninstallation

Finally, to verify that Node JS and NPM have been completely removed from your system, enter the following command:

node -v

If you get the output as below:

node: command not found

This indicates that Node JS and NPM have been successfully uninstalled from your MacOS device.

 

Conclusion

Uninstalling Node JS and NPM from MacOS can be a daunting task, but by following the step-by-step process outlined above, you can easily remove them from your system. By doing so, you can free up space on your device and ensure that there are no conflicts

Leave a Reply

Your email address will not be published. Required fields are marked *