Home >Web Front-end >Front-end Q&A >nvm how to delete nodejs
Node.js is a popular server-side programming language, which in turn has led to the popularity of its package manager npm. However, when you need to uninstall Node.js or newer versions, you also need to uninstall npm. This article explains how to completely remove Node.js and npm.
If Node.js and npm were installed on Windows through the Windows installer, then to uninstall just perform the following steps:
Note: This will only remove Node.js, not npm.
To delete npm, you need to run the following command as an administrator in a command line interface (such as PowerShell, Git Bash, or other):
npm uninstall npm -g
This command will completely delete npm. Additionally, you can check whether npm was successfully removed by running the following command:
npm -v
If the removal was successful, the command will output "command not found".
Uninstalling Node.js and npm on macOS is easier than Windows. This can be achieved by:
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
This command will completely uninstall Node.js and npm.
After entering this command line, you need to enter your macOS user password.
Run the following command in the terminal. If the uninstallation is successful, the command will output "command not found".
node -v npm -v
If you are using a Linux system, it is easier to remove Node.js and npm. You can uninstall Node.js and npm using your package manager.
sudo apt-get remove nodejs
If you do not need the package manager npm for Node.js, you can completely uninstall it using the following command:
sudo apt-get remove npm
curl -sL https://deb.nodesource.com/setup_X.x | sudo -E bash - sudo apt-get install -y nodejs
Replace X.x in the command with the version you need to install.
Run the following command in the terminal. If the uninstall is successful, the command will output "command not found".
node -v npm -v
So, through the method in this article, you can completely uninstall Node.js and npm. Note, back up your code before uninstalling. At the same time, some methods for installing Node.js and npm are also provided here to facilitate you to program better. Happy programming!
The above is the detailed content of nvm how to delete nodejs. For more information, please follow other related articles on the PHP Chinese website!