The Wayback Machine - https://web.archive.org/web/20240912200900/https://www.geeksforgeeks.org/uninstall-node-js-using-linux-command-line/
Open In App

Uninstall Node.JS Using Linux Command Line

Last Updated : 05 Jun, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

To uninstall Node.js from your Linux system using the command line, you can follow these steps. The specific commands may vary depending on your Linux distribution, so I’ll provide instructions for a few common package managers: APT (Debian/Ubuntu), YUM (Red Hat/CentOS), and DNF (Fedora).

Check if Node is Already Installed or Not

Enter the following command to see if the node is installed or not

node -v

If an output displaying the version number of the node is shown then Node is installed in the system.

node-1

Steps to Uninstall Node Using Linux Package Managers

Step 1: Enter the following command to remove node

sudo apt remove nodejs

node-4

This will uninstall nodejs from the system

Step 2: Enter the following command to remove npm

sudo apt remove npm

node-5

This will uninstall npm from the system

Step 3: Enter the following command to remove any used files

sudo apt autoremove

node-3

Step 4: Enter the command to check if nodejs is present in the system or not

node -v

node-2

FAQ’s

What if I installed Node.js using a different package manager (e.g.nvm)?

If you install node from another package manager let say nvm(Node Version Manager) then you have use the commands of the nvm to uninstall nodejs from the system

Bellow is the command to remove nodejs using nvm

nvm uninstall node

What about global npm packages?

Global npm packages are the packages that available anywhere in the system and will be deleted after nodejs is uninstall. To keep the names of the global npm use the following command bellow

 npm list -g --depth=0 > npm-global-packages.txt

It will store the global packages in a file then when you reinstall nodejs it will easier to reinstall the global packages

How do I uninstall Node.js if I installed it from the source code?

To uninstall from the source code, Navigate to that directory where you have installed and build the source code and use the following command

sudo make uninstall

How do I remove leftover configuration files after uninstalling Node.js?

To remove any leftover configuration files related to Node.js or npm, you can use the following command:

sudo apt-get purge nodejs npm

The purge option not only removes the package but also deletes the associated configuration files.

How do I uninstall Node.js on a distribution other than Ubuntu (e.g., CentOS, Fedora, or Debian)?

The specific package manager and commands may vary depending on the Linux distribution. For example, on CentOS and Fedora, you can use yum or dnf like this:

sudo yum remove nodejs npm

On Debian-based systems (e.g., Debian itself or Linux Mint), you can use apt-get like this:

sudo apt-get remove nodejs npm

Conclusion

Uninstalling Node.js on Linux involves using your package manager to remove the Node.js and npm packages. The exact command and method may vary depending on your Linux distribution and how Node.js was initially installed. Be cautious when uninstalling to ensure that you understand the implications for your system and any global npm packages you may have installed.



Similar Reads

How to Compare Files Line by Line in Linux | diff Command
In the world of Linux, managing and comparing files is a common task for system administrators and developers alike. The ability to compare files line by line is crucial for identifying differences, debugging code, and ensuring the integrity of data. One powerful tool that facilitates this process is the diff command. In this article, we will explo
9 min read
How to uninstall packages from Linux?
In this article, we will learn to uninstall the different types of packages from Linux. Let's understand the uninstalling process through some examples: Example 1: Uninstall a package using apt-get In this example, we will remove GIMP, a graphics software that was installed with the help of apt-get. Step 1: To list all the apt-get packages, enter t
2 min read
How to Uninstall Packages With Apt Package Manager in Linux
The apt command is a sophisticated command-line tool that interacts with Ubuntu's Advanced Packaging Tool (APT) to execute tasks including installing new software packages, updating the package list index, and even upgrading the whole Ubuntu system. Along with this, we can uninstall or remove the downloaded packages from the system. So in this arti
2 min read
Uninstall Linux completely from a PC with Windows
We would learn here how to completely uninstall any Linux OS from PC through Windows. This is a procedure that involves to steps-> (i) Delete Linux Partition (ii) Remove Linux OS from EFI System Partition You must be thinking what is EFI System Partition? The EFI system partition (ESP) is a partition on a storage device that is used by computers
2 min read
How to Completely Uninstall Node.js & Reinstall from Beginning (Mac OS X) ?
Node.js is a widely adopted and robust platform that allows software engineers to create high-performance and scalable web applications with ease. However, there might be instances where you need to perform a complete uninstallation of Node.js from your Mac OS X system and start anew. This necessity could arise due to various factors, such as outda
3 min read
Which command is used to run SASS code from the command line ?
In this article, we will discuss how to run SASS code from the command line. SASS (Syntactically Awesome Style Sheet) is a simple CSS pre-processor that makes it possible to create manageable, platform-independent, and reusable style sheets for websites. It is fully compatible with every version of CSS. Sass reduces the repetition of CSS and theref
3 min read
How To Add Line Break To 'git commit -m' From The Command Line?
In Git, you should frequently include multi-line, detailed messages when committing changes. Adding line breaks can be challenging, even though the git commit -m command is useful for single-line messages. You can use the command line to include line breaks in your commit messages using a variety of techniques that are covered. In this article we h
2 min read
Connecting to the Internet Using Command Line in Linux
Many of the times you may use a Linux system that does not have a GUI after install and it needs an internet connection to set up a desktop environment, also you may use Linux servers without a GUI and you need to connect over a wireless network using the command line. Below you will see Steps to connect to a wireless network using the command line
3 min read
How to Manage KVM Virtual Environment using Command Line Tools in Linux
KVM, short for Kernel-based Virtual Machine, is a complete virtualization solution for Linux running on x86 hardware (Intel VT or AMD-V). Since version 2.6.20, the mainline Linux kernel has featured KVM, a complete virtualization solution for Linux running on Intel 64 and AMD 64 hardware that is fast and stable for the majority of workloads. It con
8 min read
How to Create a Text File Using the Command Line in Linux
The Linux command line is a powerful tool that allows you to manage your system with precision and speed. One of the most common tasks is creating a text file, which can be achieved using several commands and methods. Here we will learn some quick ways to create a text file from the Linux Command Line or Terminal. Table of Content Using the 'touch'
6 min read
How to Convert DOS line endings to Linux line endings using Vim
DOS and Unix/Linux file formats differ slightly such that the ASCII characters used at the line endings are different. Unix file format uses an LF character to end a line, LF stands for LineFeed, which means moving the cursor down. Unix-based systems and Mac OS X & later use this format. While the DOS file format uses a CR character before the
2 min read
Ccat – Colorize Cat Command Output command in Linux with Examples
ccat is a command-line tool for Linux and OSX, which is similar to the cat command in Linux. But the difference between cat and ccat is that the ccat shows the content of the file with the syntax highlighted. Currently, ccat supports the following programming languages. JavaScriptJavaRubyPythonGoCJSONInstallation of Ccat First, we are going to see
2 min read
How to Display Command History in Linux | history Command
The command-line interface in Linux provides powerful tools for users, and mastering command history is essential for efficient navigation and retrieval of previously executed commands. The history command is a valuable utility that allows users to view and search through their command history. In this comprehensive guide, we will explore the vario
4 min read
Kali Linux - Command Line Essentials
Command-line plays a vital role while working with Kali Linux as most of its tools don't have a Graphical User Interface and if you are performing ethical hacking or penetration testing then most of the time you will have to work with command Line Interface itself. While executing a command in Kali Linux we enter a command on the terminal emulator
3 min read
Deepl - Command Line Language Translator Tool for Linux
Deepl is the best language translator command-line tool that detects the language of input text and translates it into the desired language using advanced machine learning and neural networking algorithms. It is open source and powered by a German tech Company under the MIT license. It supports the following languages English (EN)Italian (IT)Spanis
3 min read
How to Convert PDF to Image in Linux Command Line?
Pdftoppm is a tool that converts PDF document files into .PNG format and many other formats. We can use this tool on Linux to convert the PDF into images. It also provides the features like the cropping image, set resolution, and scale, and many more. Now let's see how to install the pdftoppm Installation of pdftoppm: To install the pdftoppm, we ne
3 min read
How to Install and Use Sysdig from Linux Command Line?
Sysdig is a tool that provides administrators and developers with unparalleled insight into their systems' behavior. The team behind it hopes to enhance system-level monitoring and troubleshooting by providing a centralized, coherent, and granular view of the storage, transmission, network, and memory subsystems, as well as the ability to generate
2 min read
Aria2 - Multi-Protocol Command-Line Download Tool for Linux
Aria2 is an open-source lightweight multi-protocol, multi-server & multi-source command-line utility that is used for downloading files in Windows, Linux, and Mac. Aria2 is used to download a file at a good speed by utilizing your maximum download bandwidth from multiple sources/protocols such as HTTP(S), FTP, SFTP, Bittorrent, and Metalink. Yo
4 min read
Optimize and Compress JPEG or PNG Images in Linux Command line
Today there are many GUI tools that compress and optimize the images, which are very useful. But if you are terminal addicted and want to compress and optimize the images in the terminal before uploading to the cloud, then you can do it. There are two tools by using which we can compress and optimize images. These are - jpegoptimOptiPNGjpegoptim jp
4 min read
Top Linux Command Line Tips and Tricks
Linux is a great OS that offers multiple options for simplifying tasks. It has everything you need for working more efficiently, whether a command-line or a GUI. However, many people don't know the Linux command line's short tricks and end up being stuck in complex tasks. An interface (text-based) through which you communicate with your system's OS
5 min read
How to Pass Command Line Arguments to GDB in a Linux Environment?
The GNU Debugger, commonly known as GDB, is a powerful tool used for debugging and analyzing programs in Linux and other Unix-like operating systems. While GDB is commonly used to debug programs, it can also be used to launch programs with specific command line arguments. This article will walk you through the process of passing command line argume
6 min read
Open Google Chrome From The Linux Command Line
Google Chrome is known as the most used and widely popular web browser because of its fast and better performance. In this article we will learn how we can open the Google Chrome application by using the terminal in Linux along with this we will also look at some you should command line switches to help you to start using the Google Chrome browser
6 min read
MySQL in Kali Linux Command Line
Below is a comprehensive MySQL Command Line tutorial for Kali Linux, starting from beginner to advanced levels. MySQL is a popular open-source relational database management system, and Kali Linux is a Debian-based Linux distribution often used for penetration testing and ethical hacking. Make sure you have MySQL installed on your Kali Linux system
10 min read
Manage Network Connections From the Linux Command Line with nmcli
Network connectivity is a critical aspect of modern computing, and Linux provides a robust command-line tool for managing network connections: nmcli. Network Manager Command-Line Interface (nmcli) is a powerful and versatile utility that allows users to control and configure network settings directly from the terminal. In this article, we will delv
5 min read
Command-Line Tools and Utilities For Network Management in Linux
If you are thinking of becoming a system administrator, or you are already a system admin, then this article is for you. As a system admin, your daily routine will include configuring, maintaining, troubleshooting, monitoring, securing networks, and managing servers within data centers. Network configuration and troubleshooting are some important t
8 min read
How to Download YouTube Videos in Linux Command Line?
The content has been removed.
1 min read
How to Read a File Line by Line using Node.js ?
The ability to Read a File Line by Line using Node allows us to read large files without entirely storing them in memory. It is useful in saving resources and improving the efficiency of the application. It allows us to look for the information that is required and once the relevant information is found, we can stop the search process and can preve
3 min read
How to print command line arguments passed to the script in Node.js ?
Node.js is an open-source and cross-platform runtime environment built on Chrome's V8 engine that enables us to use JavaScript outside the browser. Node.js helps us to use build server-side applications using JavaScript. In Node.js if you want to print the command line arguments then we can access the argv property on the process object. process.ar
2 min read
How to build your own CLI (Command Line Interface) with Node.js ?
Introduction: A command-line interface (CLI) is a text-based user interface (UI) for running programs, managing files, and interacting with computers. Building your own CLI is easier than you might think with Node.js. There are a bunch of open-source packages that can handle color, animation, and user input with ease. In this article, we will be bu
2 min read
Command Line Flags by the Node Binary
In this article, we will learn about the command line flags offered by the Node binary. The Node.js platform is almost entirely represented by the node binary executable. In order to execute a JavaScript program we use: node app.js, where app.js is the program we wish to run. However, before we can start running programs, we need to learn some basi
6 min read