Last Updated :
07 Jun, 2024
We can remove the nodejs from window by uninstalling it from the programs list. Node.js is a popular JavaScript runtime used for building server-side applications. However, there may come a time when you need to remove Node.js from your Windows system completely. Whether it’s due to a corrupted installation, needing to install a different version, or simply not needing it anymore, here’s a comprehensive guide to uninstall Node.js from your Windows machine.
Steps to Completely Remove Node.js from Windows
Step 1: Whenever we install a package with the command npm install <package name>, npm stores the cache inside the user file system. The default directory where the cache data is stored on Windows is %AppData%/npm-cache. So, we need to clean the cache first. The cache can be cleaned by using the following command.
npm cache clean --force
Step 2: After that, you can verify the cache by using the below command:
npm cache verify
Step 3: Now open the control panel in the computer. Search for Program and features. Under the program and features click on Uninstall a program. Now search for Node.js and uninstall it.
Step 4: Restart your computer or kill all node-related processes from Task Manager.
Step 5: Look for folder in your computer and if they are present remove them. The folders and files may or may not exist in your computer depending on various factors like installed version or CPU architecture.
- C:\Program Files (x86)\Nodejs
- C:\Program Files\Nodejs
- C:\Users\{User}\AppData\Roaming\npm or open run and type appdata and click ok and open roaming there you will find npm.
- C:\Users\{User}\AppData\Roaming\npm-cache or open run and type appdata and click ok and open roaming there you will find npm-cache.
- C:\Users\{User}\.npmrc
- C:\Users\{User}\package.json
- C:\Users\{User}\package-lock.json
- C:\Users\{User}\AppData\Local\Temp\npm-*
Step 6: After that check the environment path variables and make sure no references to npm or Node.js exist.
Step 7: If Node.js is still not uninstalled then open the command prompt and type the below command:
where node
Step 8: If Node.js is not uninstalled the command will output the location of Node.js. Go to that location and uninstall the directory.
Step 9: Restart the computer. Node.js is now completely uninstalled.
Conclusion
By following these steps, you should have completely removed Node.js and npm from your Windows system. This thorough process ensures that no residual files or environment variables are left behind, which is especially important if you plan to reinstall Node.js or switch to a different version. If you encounter any issues during the removal process, restarting your computer and repeating the steps can help resolve them.
To completely remove Node.js from your computer, follow the steps based on your operating system:
Windows 🖥️
1. Uninstall Node.js via Control Panel
- Press
Win + R
, typeappwiz.cpl
, and hit Enter. - Locate Node.js in the list.
- Right-click it and select Uninstall.
- Follow the uninstallation wizard.
2. Delete Remaining Files & Folders
- Open File Explorer and delete:
1 C:\Program Files\nodejs
2 C:\Users\<YourUsername>\AppData\Roaming\npm
3 C:\Users\<YourUsername>\AppData\Roaming\npm-cache
4 C:\Users\<YourUsername>\.npmrc (if exists)
3. Remove Node.js from Environment Variables
- Press
Win + R
, typesysdm.cpl
, and press Enter. - Go to Advanced → Click Environment Variables.
- Find Path under System variables, and remove entries for Node.js.
- Click
OK
.
4. Verify Removal
Open Command Prompt (Win + R
→ type cmd
→ Enter) and run:
If Node.js is removed, you’ll see a «command not found» error.
MacOS 🍏
1. Uninstall via Homebrew (If Installed with Brew)
If you installed Node.js using Homebrew, run:
2. Manually Delete Files
Remove all Node.js-related files:
1 sudo rm -rf /usr/local/lib/node_modules
2 sudo rm -rf /usr/local/include/node
3 sudo rm -rf /usr/local/bin/node
4 sudo rm -rf ~/.npm ~/.nvm ~/.node
3. Check and Remove Environment Variables
Open Terminal and edit your shell configuration file:
1 nano ~/.bashrc # For Bash users
2 nano ~/.zshrc # For Zsh users (default in macOS)
Remove any lines related to node
or npm
. Save and exit.
4. Verify Removal
Check if Node.js is gone:
If it’s removed, the commands will return «command not found».
Linux (Ubuntu/Debian-based) 🐧
1. Remove Node.js via Package Manager
If installed via apt, run:
1 sudo apt-get remove --purge nodejs
2 sudo apt-get autoremove
For nvm (Node Version Manager) users, uninstall with:
1 nvm deactivate
2 nvm uninstall node
2. Delete Node.js Files
1 sudo rm -rf /usr/local/lib/node_modules
2 sudo rm -rf /usr/local/include/node
3 sudo rm -rf /usr/local/bin/node
4 sudo rm -rf ~/.npm ~/.nvm ~/.node
3. Remove Node.js from Environment Variables
Edit your shell configuration file:
1 nano ~/.bashrc # For Bash users
2 nano ~/.zshrc # For Zsh users
Remove any Node.js-related paths and restart your terminal.
4. Verify Removal
If Node.js is fully removed, the commands will return «command not found».
Node.js is now completely removed from your computer! 🎉
Node.js is an essential runtime for JavaScript, and npm (Node Package Manager) is its package manager. However, there are times when you need to completely uninstall and reinstall Node.js and npm, whether due to version conflicts, broken installations, or upgrading to a newer version.
This guide will cover three different methods to uninstall and reinstall Node.js and npm on Windows, macOS, and Linux.
🛠 Method 1: Uninstall & Reinstall Node.js and npm Manually
If you installed Node.js via the official installer or a package manager other than nvm
or brew
, you’ll need to manually remove it.
🔹 Windows (Manual Uninstallation)
Uninstall Node.js
- Open Control Panel → Programs → Programs and Features.
- Find Node.js in the list.
- Click Uninstall and follow the prompts.
Remove npm Cache & Environment Variables
- Delete the global npm modules:
rd /s /q "%AppData%\npm"
rd /s /q "%AppData%\npm-cache"
Enter fullscreen mode
Exit fullscreen mode
- Remove Node.js from System Environment Variables:
- Press
Win + R
, typesysdm.cpl
, and hit Enter. - Go to the Advanced tab and click Environment Variables.
- Under System Variables, find
NODE_PATH
, select it, and click Delete. - Look for
Path
, edit it, and remove any reference to Node.js.
- Press
Verify Node.js Removal
Run the following in PowerShell or CMD:
node -v
npm -v
Enter fullscreen mode
Exit fullscreen mode
If it returns "command not found"
, Node.js has been successfully removed.
🔹 macOS (Manual Uninstallation)
Remove Node.js and npm
- Open Terminal and run:
sudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/local/include/node
sudo rm -rf /usr/local/lib/node_modules
Enter fullscreen mode
Exit fullscreen mode
- Remove npm cache:
rm -rf ~/.npm
rm -rf ~/.node-gyp
Enter fullscreen mode
Exit fullscreen mode
- If you installed Node.js using the
.pkg
file, you can also remove it via:
sudo rm -rf /usr/local/lib/dtrace/node.d
Enter fullscreen mode
Exit fullscreen mode
Verify Uninstallation
node -v
npm -v
Enter fullscreen mode
Exit fullscreen mode
If they are no longer recognized, Node.js is fully removed.
🔹 Linux (Manual Uninstallation)
Remove Node.js and npm
- Run the following command:
sudo apt-get remove --purge nodejs npm
Enter fullscreen mode
Exit fullscreen mode
- Clean up global npm packages:
sudo rm -rf /usr/local/lib/node_modules
rm -rf ~/.npm
Enter fullscreen mode
Exit fullscreen mode
Verify Uninstallation
node -v
npm -v
Enter fullscreen mode
Exit fullscreen mode
🛠 Method 2: Uninstall & Reinstall Node.js via Homebrew (macOS & Linux)
If you installed Node.js via Homebrew, you can easily uninstall and reinstall it.
🔹 Uninstall Node.js using Homebrew
- Open Terminal and run:
brew uninstall node
Enter fullscreen mode
Exit fullscreen mode
- Clean up leftover files:
brew cleanup
Enter fullscreen mode
Exit fullscreen mode
Verify Node.js Removal
node -v
npm -v
Enter fullscreen mode
Exit fullscreen mode
If Node.js is not found, it has been successfully removed.
🔄 Reinstall Node.js using Homebrew
To reinstall:
brew install node
Enter fullscreen mode
Exit fullscreen mode
After installation, verify:
node -v
npm -v
Enter fullscreen mode
Exit fullscreen mode
🛠 Method 3: Uninstall & Reinstall Node.js using nvm (Node Version Manager) (My Personal Preference)
If you installed Node.js using nvm, this is the easiest way to manage multiple Node.js versions.
The link to the source code can be found here: nvm-sh/nvm.
🔹 Uninstall Node.js using nvm
- Open Terminal (or PowerShell for Windows).
- Run the following command:
nvm uninstall <version>
Enter fullscreen mode
Exit fullscreen mode
Replace <version>
with the installed Node.js version. You can check installed versions with:
nvm ls
Enter fullscreen mode
Exit fullscreen mode
- To completely remove
nvm
(optional), delete its directory:
rm -rf ~/.nvm
Enter fullscreen mode
Exit fullscreen mode
🔄 Reinstall Node.js using nvm
- First, make sure
nvm
is installed:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
Enter fullscreen mode
Exit fullscreen mode
If you are like me and have some problems with the PATH of your nvm installation, run the following command (from the source repository):
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Enter fullscreen mode
Exit fullscreen mode
- Reload your shell configuration:
source ~/.zshrc # For macOS/Linux (zsh users)
source ~/.bashrc # For Linux/macOS (bash users)
Enter fullscreen mode
Exit fullscreen mode
- Install the latest LTS version of Node.js:
nvm install --lts
Enter fullscreen mode
Exit fullscreen mode
- Verify installation:
node -v
npm -v
Enter fullscreen mode
Exit fullscreen mode
🎯 Summary of Uninstallation & Reinstallation Methods
Method | Windows | macOS | Linux |
---|---|---|---|
Manual | Control Panel → Remove Node.js, delete cache |
rm -rf Node files |
apt-get remove |
Homebrew | ❌ Not available | brew uninstall node |
brew uninstall node |
nvm | nvm uninstall <version> |
nvm uninstall <version> |
nvm uninstall <version> |
🚀 Which Method Should You Use?
- For beginners: Use the manual method (Control Panel for Windows, Terminal for macOS/Linux).
-
For developers: If you installed Node.js via
brew
, use Homebrew for easy management. -
For advanced users: Use
nvm
if you frequently switch between Node.js versions easily.
💡 Final Thoughts
Now you know how to completely uninstall and reinstall Node.js and npm using three different methods across Windows, macOS, and Linux. Using nvm
is generally the best option for developers as it allows you to switch between different Node.js versions easily.
Let me know if you run into any issues! 🚀
TL;DR
- Manual Method: Control Panel (Windows), Terminal (macOS/Linux).
-
Homebrew:
brew uninstall node
(macOS/Linux). -
nvm:
nvm uninstall <version>
,nvm install --lts
.
Node.js is an innovative and powerful tool for developers building diverse applications, from web servers to command-line interfaces. Its speed and versatility powered by the V8 JavaScript engine have cemented its popularity. However, there are moments when uninstalling Node.js becomes necessary, whether for an upgrade, troubleshooting, or shifting project requirements.
This guide provides comprehensive instructions for uninstalling Node.js across Windows, macOS, and Linux systems. By providing detailed, step-by-step instructions, we aim to make the process as smooth and error-free as possible for you.
Why Uninstall Node.js?
There are several reasons why you might find yourself needing to uninstall Node.js from your computer. These reasons often revolve around the management and maintenance of your development environment, including React Native development. Here are the most common scenarios:
- Version Upgrade: The most frequent cause for uninstalling Node.js is to upgrade to a newer version. Node.js is constantly evolving, with new features and performance improvements. Upgrading ensures access to these benefits, along with enhanced security patches.
- Troubleshooting Issues: Sometimes, your Node.js installation might encounter issues due to corrupted files or conflicts with other software. Uninstalling and then reinstalling Node.js can often resolve these problems.
- Switching Environments: Developers often switch between different environments or project requirements that necessitate different versions of Node.js. In such cases, removing the current version provides a clean slate for installing the specific version required.
- System Cleanup: If you’re no longer working on Node.js projects or need to free up disk space, uninstalling Node.js helps tidy up your system, ensuring it runs efficiently.
Before removing Node.js from your system, it’s worth considering the uses of Node.js before making a final decision.
Preparation Before Uninstallation
Before proceeding with the uninstallation of Node.js, you must take a few preparatory steps to safeguard your development environment. Here’s what you need to do:
1. Backup Your Projects:
Safeguarding your work is important. Make sure all your current projects are fully backed up. Use a cloud service, external drive, or another storage solution to store copies of your work. This step prevents any accidental loss of data during the uninstallation process.
2. List Global Packages:
Node.js allows the installation of packages globally, making them accessible across projects. These global packages might be essential tools for your development workflow. To list all global packages you have installed, open a terminal or command prompt and run the command npm list -g –depth=0. This will display all globally installed packages at the top level, making it easier for you to note them down. Consider creating a document or a note with the list of these packages, as you may need to reinstall them after setting up Node.js again.
Uninstallation Methods (All Operating Systems):
Windows:
Uninstalling Node.js from a Windows system can be done through two main approaches: using the Control Panel or utilizing the Command Prompt for a more manual uninstallation. Here’s a guide to both methods:
1. Using the Control Panel
- Open the Control Panel on your Windows system.
- Click on “Programs and Features” or “Uninstall a program” under the Programs section.
- Scroll through the list until you find Node.js. Click on it to select it, then click the “Uninstall” button near the top of the window. Follow the on-screen prompts to complete the uninstallation process.
- After uninstalling Node.js, it’s a good idea to check for any remaining folders or files that may not have been removed. Common directories to check include:
- C:\Program Files\nodejs
- C:\Users\[Your Username]\AppData\Roaming\npm (for npm packages)
- C:\Users\[Your Username]\AppData\Roaming\npm-cache (for npm cache)
- If these directories exist, delete them to ensure a clean uninstall.
2. Using Command Prompt (Alternative Method)
- Press Win + R, type cmd, and press Enter to open the Command Prompt.
- While the Command Prompt doesn’t directly offer an “uninstall” command for Node.js itself, you can start by removing the global packages you’ve installed. Type npm uninstall -g <package-name> for each global package you wish to remove.
- After removing global packages, you must manually delete the Node.js installation and associated directories. Go Node.js installation folder (usually C:\Program Files\nodejs) and delete it. Additionally, remove the npm and npm-cache directories located in C:\Users\[Your Username]\AppData\Roaming\.
- Finally, you might need to remove references to Node.js from your system’s environment variables. This can be done through the System Properties -> Environment Variables dialog, searching for and removing any variables related to Node.js (like NODE_PATH).
MacOS:
For macOS users, uninstalling Node.js can be performed through various methods, depending on how Node.js was initially installed. The process is straightforward if you use Homebrew, a popular package manager for macOS. Alternatively, if you installed Node.js directly from a package or in another manner, you might need to follow manual removal steps.
1. Uninstalling Node.js Installed via Homebrew
If you installed Node.js using Homebrew, you could uninstall it easily with the following command:
- Launch the Terminal application from your Applications/Utilities folder or search for it using Spotlight.
- In the Terminal, type the following command and press
- This command tells Homebrew to remove Node.js from your system.
2. Manual Removal for Other Installation Methods
If you didn’t use Homebrew or need to ensure Node.js is completely removed, including all its files and directories, follow these steps:
- Open Terminal and use the following commands to remove the main Node.js directories. These commands delete the Node.js binaries, modules, and cache from your system.
- Remove Node.js binaries:
- Remove Node.js modules: cal/lib/node_modules
- You might also want to check for and remove any global npm packages or cache directories:
- Update your system’s $PATH if it includes references to Node.js or npm directories by editing your ~/.bash_profile, ~/.bashrc, ~/.zshrc, or other shell configuration files.
- Verify Removal: After deleting these directories, you can verify that Node.js is uninstalled by typing node -v and npm -v in the Terminal. If uninstalled, these commands should return an error or indicate that Node.js and npm are not found.
Linux:
Uninstalling Node.js on Linux systems can be approached through the package manager provided by your Linux distribution or via manual removal if Node.js was installed from the source. Here’s how you can do both:
1. Uninstalling Node.js Using Package Manager
For Debian/Ubuntu:
- Access the Terminal by searching for it in your applications menu or using a shortcut, typically Ctrl + Alt + T.
- In the Terminal, type the following command and press Enter:
- This command will prompt for your password and then proceed to remove Node.js from your system.
- If you also want to remove npm and other related packages, you can use:
- And to clean up any unused packages:
For RedHat/CentOS:
- Open Terminal
- Type the following command and hit Enter:
- This will remove Node.js from your RedHat or CentOS system.
- Consider running sudo yum autoremove to remove any packages that were installed with Node.js and are no longer needed.
2. Manual Removal for Node.js Installed from Source
If you installed Node.js by compiling it from source, you’ll need to manually remove the binaries, modules, and other files.
- Remove Binaries: The main executable for Node.js is typically installed in /usr/local/bin. You can remove it by running:
- Remove Libraries: Node.js libraries are located in /usr/local/lib. Use the following command to remove them:
- Additional Directories: Depending on how Node.js was configured, you might also need to remove other directories, such as:
- Environment Cleanup: If you added Node.js to your PATH or set any environment variables related to Node.js, remember to remove those entries from files like ~/.bashrc, ~/.profile, or ~/.bash_profile.
- Verification: After completing these steps, you can verify the removal by typing node -v and npm -v in the Terminal. If properly removed, these commands should not return a version number but report that Node.js and npm are not installed.
Troubleshooting Common Issues
During the uninstallation of Node.js, users might encounter several issues that can hinder the process. Addressing these common problems ensures a smoother experience. Here’s how to troubleshoot some of the frequent issues:
1. Node.js or npm Still Accessible After Uninstallation
- Incomplete Uninstallation: If, after uninstallation, node -v or npm -v still returns version numbers, it likely means the uninstallation process was incomplete. Ensure all Node.js and npm files and directories have been removed, including manually deleting any leftover directories mentioned in previous steps.
- Path Environment Variable: Check your system’s PATH environment variable. If it still contains references to Node.js or npm directories, remove these paths.
- Restart Terminal or System: Sometimes, changes to the environment variables or system paths don’t take effect until you restart your Terminal or Command Prompt, or in some cases, your entire system.
2. Errors During Uninstallation
- Permission Issues: If you encounter permission errors during uninstallation, especially on macOS and Linux, ensure you’re using sudo (for macOS and Linux) to grant administrative privileges to your commands. On Windows, run the Command Prompt as an Administrator.
- Package Manager Problems: When using a package manager like apt-get, yum, or Homebrew, and you run into errors, try running sudo apt-get update or brew update to refresh your package manager’s database. This can resolve issues related to outdated information.
3. Unable to Reinstall Node.js
- Corrupted Installation: If a previous installation was corrupted or incomplete, clear any caches related to your installation method. For npm, you can use npm cache clean –force. For Homebrew, try brew cleanup.
- Conflicting Versions: Ensure that there are no conflicting versions of Node.js or npm. Use a version manager like nvm or nvm-windows to manage multiple versions more effectively.
General Tips
- Documentation and Forums: The official Node.js website, Stack Overflow, and GitHub issues are excellent resources for troubleshooting specific errors. Often, someone else has encountered the same issue, and solutions or workarounds are available.
- Clean System Reboot: Sometimes, a clean reboot of your system can resolve lingering issues by clearing out any processes that might be using Node.js or npm files.
- Version Manager Use: Utilizing a version manager from the start can prevent many of these issues by isolating Node.js versions and dependencies from the system-wide environment, making installation, uninstallation, and version switching much more straightforward.
How Can VisionX Boost Your Business With Node.js?
VisionX has comprehensive software development services that leverage the power of Node.js. We specialize in building:
- Custom Node.js applications tailored to your specific business needs.
- High-performance, scalable solutions that can handle growing demands.
- Full-stack applications with seamless integration of front-end and back-end using Node.js.
Our team of experienced developers ensures your project is delivered on time and efficiently.
Conclusion
Uninstalling Node.js is often a necessary part of development, whether for troubleshooting, upgrades, or environment changes. While the process can seem daunting, this guide has aimed to provide actionable steps for smooth removal across operating systems.
The key is being prepared by backing up existing projects, noting global packages for later reinstallation, and understanding what directories require deletion. Each platform then has its quirks – utilizing Control Panel or Command Prompt on Windows, Homebrew or manual deletion on macOS, and package managers or source uninstalls on Linux.
With the proper commands and some diligence in following instructions, uninstalling Node.js can be straightforward. Common issues like permissions, outdated installers, or environment variable conflicts also have tractable solutions outlined here. Stepping through this process with care can save much frustration down the road.
Preparing for Uninstallation
Before you uninstall Node.js, follow these steps:
- Back-Up Your Files: Save any important data or project files related to Node.js, including configurations within your IDE Node.js setup if you’re using one. This helps preserve settings you may want to reuse later.
- Check Versions: Make sure you know which versions of Node.js and npm are installed.
- How to Check:
- Open the terminal or command prompt.
- Type node -v and press Enter to see the Node.js version.
- Type npm -v and press Enter to see the npm version.
- How to Check:
- Proceed with Uninstallation: Once you have backed up your files and noted the versions, you can safely uninstall Node.js.
This ensures you don’t lose important information and remove the correct versions from your system.
How to Uninstall Node in Windows
Uninstalling Node.js on Windows involves a lot of steps to ensure that all components are completely removed. Make sure to follow each step to avoid leaving behind any residual files.
Step 1: Clear npm Cache
To begin, clear all cached data stored by npm using the command npm cache clean –force. This ensures no leftover cache files interfere with future installations or affect system performance.
Step 2: Verify Cache Clearance
Once the cache is removed, make sure to run npm cache verify to confirm.
Step 3: Uninstall Node.js Application
To uninstall Node.js:
- Open the Control Panel.
- Click on “Programs and Features.”
- Find and select “Node.js” from the list.
- Click the “Uninstall” button.
This will remove Node.js from your computer.
Step 4: End Node.js Processes
Open Task Manager (Ctrl + Shift + Esc) and check for any Node.js processes that might be running. If any are active, end them to prevent interference during uninstallation. Alternatively, restarting the system can help clear all Node.js processes.
Step 5: Remove Node.js Environment Variables
Open System Properties.
Go to the Advanced tab and click on ‘Environment Variables’.
Find and remove any Node.js paths, such as
C:\Program Files (x86)\Nodejs
C:\Program Files\Nodejs
C:\Users\{User}\AppData\Roaming\npm
C:\Users\{User}\AppData\Roaming\npm-cache
C:\Users\{User}\.npmrc
C:\Users\{User}\package.json
C:\Users\{User}\package-lock.json
C:\Users\{User}\AppData\Local\Temp\npm-*
To access the directories, type appdata in the Run dialog (Win + R), then navigate to Roaming.
Step 6: Apply Changes
After removing the environment variables, ensure all changes are saved by clicking “OK” to close each dialog box.
Step 7: Verify Uninstallation
Finally, make sure Node.js is fully removed by opening the command prompt and typing where node. If any Node.js directories still exist, manually navigate to the paths and delete them.
Uninstall Node.js Ubuntu
Step 1: Uninstall Node.js and npm via APT
If you installed Node.js using Ubuntu’s package manager:
Command:
sudo apt-get purge nodejs npm
sudo apt-get autoremove
Explanation:
This command removes Node.js, npm, and their associated configuration files. The autoremove command cleans up any unused dependencies.
Step 2: Remove Residual Files and Directories
Command:
sudo rm -rf ~/.npm ~/.node-gyp
sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf /usr/local/bin/node /usr/local/bin/npm
Explanation:
These commands delete user-specific and system-wide residual files and directories related to Node.js and npm.
Step 3: Remove Node.js APT Source Entries
Command:
sudo rm /etc/apt/sources.list.d/nodesource.list
sudo apt-get update
Explanation:
This removes the NodeSource repository entry from APT sources and updates the package list.
Step 4: Uninstall Node.js Installed via Snap
Command:
sudo snap remove node
Explanation:
If Node.js was installed using Snap, this command will remove it.
Step 5: Uninstall Node.js Installed via NVM
Command:
nvm ls
nvm uninstall <version>
rm -rf ~/.nvm
Explanation:
These commands list installed Node.js versions via NVM, uninstall a specific version, and remove NVM itself.
Step 6: Verify Uninstallation
Command:
node -v
npm -v
Explanation:
Running these commands should result in errors indicating that Node.js and npm are no longer installed.
Uninstallation Steps for Linux (Ubuntu)
This section outlines the steps to uninstall Node.js on Ubuntu systems. Carefully execute each step to ensure a thorough uninstallation.
Step 1: Remove Node.js
To uninstall Node.js on Ubuntu, open the terminal and enter:
sudo apt-get remove nodejs
Step 2: Remove npm
To uninstall npm and Node.js, enter this command in the terminal:
sudo apt-get remove npm
This will remove both npm and Node.js from your system.
Step 3: Clean Up Residual Files
Follow Step 7 from the Windows section. Check for residual folders and files by running whereis node. Any remaining files related to Node.js should be manually deleted to ensure a clean removal.
Uninstallation Steps for macOS
Uninstalling Node.js on macOS can be done in two ways- using Homebrew or manually deleting files. This section covers both methods to ensure a thorough removal.
Step 1: Remove Node.js and npm
To uninstall Node.js installed with Homebrew, open your terminal and run:
brew uninstall node
If you installed Node.js manually, you can remove it and npm by deleting these folders:
/usr/local/bin/node
/usr/local/lib/node_modules
Simply navigate to these directories and delete them to complete the uninstallation.
Step 2: Remove Residual Files
Type the following commands to delete any leftover Node.js folders after opening the terminal:
rm -rf /usr/local/bin/node
rm -rf /usr/local/bin/node_modules
rm -rf ~/.npm
rm -rf ~/.node-gyp
Step 3: Clean Up Environment Variables
Check your shell profile files (e.g., .bash_profile, .zshrc) for any environment variables related to Node.js. Edit the files and remove any Node.js references to ensure no environment variables remain.
Verifying Complete Uninstallation
To ensure a complete uninstallation, use system commands such as where node (on Windows) or where is node (on Linux) to check for any remaining Node.js files or directories. Manually inspect and delete any residual folders or environment variables. These steps are important to make sure Node.js is completely removed from your computer. Now that you have deleted NodeJS maybe try switching to Python for your web app development needs.
As you clean up your system, you might explore advanced use cases like node js app development, especially if you’re considering a fresh stack for mobile or full-stack applications.
Troubleshooting
Issues can easily arise during the uninstallation process. For example, leftover files may prevent a clean uninstall or certain processes may remain active. If you encounter problems, use Task Manager (Windows) or Terminal (Linux/macOS) to terminate any Node.js processes and manually remove residual files.
Conclusion
In this guide, we’ve discussed how to delete NodeJS from Windows, Linux, and macOS systems, covering all the necessary steps to ensure a clean uninstallation. Following these best practices will leave your system free from residual files and processes, keeping it in optimal condition for future development needs. And if you ever change your mind, Soft Suave app development services are always here to help you with your next big project!