Home > Article > Web Front-end > How to uninstall clean nodejs
Node.js is an open source JavaScript runtime environment that allows developers to develop server-side applications using the JavaScript language. As Node.js becomes more and more popular, the number of users is also growing. However, sometimes we need to uninstall Node.js. Uninstalling Node.js may not only mean deleting binary files, but also need to uninstall related dependencies and components. This article will introduce readers to how to uninstall Node.js correctly, cleanly and safely.
The method of uninstalling Node.js varies depending on the operating system. This article will introduce it to you one by one.
In Windows systems, you can uninstall Node.js through the following steps:
In macOS system, you can uninstall Node.js by following these steps:
brew uninstall node
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/ Homebrew/install/master/install)"
In Linux systems, you can uninstall Node.js with the following command:
whereis node
sudo apt-get remove npm
sudo apt-get remove --purge nodejs
For other Linux distributions, use the appropriate package manager to uninstall Node.js.
Node.js includes not just basic binaries, but many components and dependencies. These components and dependencies may include the following:
If you do not clean these components and dependencies, they may take up your disk space and interfere with your system. Therefore, it is recommended that you perform the following tasks to clean up these components and dependencies after uninstalling Node.js:
Execute the following command in the terminal to remove NPM:
In Windows systems:
npm uninstall -g npm
In macOS systems:
brew uninstall npm
In Linux systems:
sudo apt-get remove npm
Execute the following command in the terminal to delete the Node.js binary:
In Windows system:
Delete all files and files in the Node.js installation directory folder.
In macOS system:
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{ npm*,node*,man1/node*}
In Linux system:
sudo rm -rf /usr/local/lib/node* /usr/ local/bin/node* /usr/local/include/node* /usr/local/share/man/man1/node*
Node.js installation package has a built-in MIT license, which you can find in the installation directory. You can delete it if you think this is necessary. For example, on macOS, you can use the following command to remove the MIT license:
sudo rm /usr/local/lib/node*/LICENSE
Execute the following command in the terminal to delete the Node.js package store:
In Windows system:
Delete package Stores all files and folders in the directory.
In macOS system:
sudo rm -rf /usr/local/lib/node_modules
In Linux system:
sudo rm -rf /usr/local/lib/node_modules
Execute the following command in the terminal to Deleting Node.js modules:
On Windows systems:
Delete all files and folders in the module storage directory.
In macOS system:
sudo rm -rf /usr/local/include/node /usr/local/lib/node_modules /usr/local/share/man/man1 /node* /usr/local/bin/node
In Linux system:
sudo rm -rf /usr/local/include/node /usr/local /lib/node_modules /usr/local/share/man/man1/node* /usr/local/bin/node
Uninstalling Node.js may sometimes be more important than installing Node.js. While uninstallation only requires a few simple steps, completely cleaning up dependencies and components can be tedious. Therefore, it is recommended that you perform a cleanup task after the uninstall is complete to ensure that your system is clean, safe, and uninterrupted. You can uninstall Node.js and clean components and dependencies by following the steps described in this article.
The above is the detailed content of How to uninstall clean nodejs. For more information, please follow other related articles on the PHP Chinese website!