How to install Node.js and npm in Arch Linux

Endrit Qerreti

Endrit Qerreti

In this tutorial, you will learn how to install Node.js in Arch Linux.

If you browse Arch linux repositories, you will see that Node.js and npm package are available in the extra repository, which means to install Node.js and npm in your Arch Linux machine, you can do so by using pacman, or any other package manager like Paru

In this tutorial, we'll be installing the latest version of Node.js and npm via pacman.

Step 1 - Update Arch Linux

Before installing Node.js in Arch Linux, ensure that pacman database is updated.

To update pacman database in Arch Linux is quite easily, and it can be done by using pacman via the -Syu option.

To do so, run the command below.

sudo pacman -Syu

Next, confirm that you want to update pacman database by pressing Y, then enter.

Once pacman database is updated, you will see a similar output in your terminal.

Step 2 - Install Node.js

Since both packages, node.js and npm are available in the community repository, installing them doesn't require you to add a third party repository in order to install them on your system.

To install Node.js and npm via pacman, simply run the command below.

pacman -S nodejs npm

Next, proceed to install nodejs and npm by pressing Y in this prompt as shown in the screenshot below.

And the installation process of nodejs and npm will begin.

Step 3 - Verify Node.js and npm Installations

Node.js and npm should be now installed in your Arch Linux machine.

Before you start using node.js or npm, check node.js and npm version to ensure that both packages were installed correctly.

To check Node.js version, run the following command.

nodejs --version

To check npm version, you can do so by running the command below.

npm --version

As you can see, both commands are returning version for node.js and npm. If you don't get any output when you run the version commands above, then you may have a broken installation of node.js and npm, which means you need to reinstall them.

Uninstall Node.js in Arch Linux

If you no longer need Node.js in your Arch Linux, then you can easily uninstall it by running the command below.

If you try to remove Node.js by using -R option, you will encounter the error "failed to prepare transaction (could not satisfy dependencies)", because -R can only remove a package and not dependencies.

To remove nodejs and its dependencies you need to use the -Rsc option as below.

sudo pacman -Rsc nodejs

Uninstall npm in Arch Linux

To uninstall npm in Arch Linux, you can do so by using pacman.

sudo pacman -R npm


In this tutorial, you learned how to install Node.js and npm in Arch Linux, by installing the packages nodejs and npm that are found in the extra repository of Arch Linux.