How to Install Latest Versions of Node.js and Npm on Kali Linux

In this tutorial, we will install Node.js and npm on Kali Linux using the NodeSource repository, which provides the latest versions. Let’s begin:

1. Open terminal by pressing “Ctrl + Alt + t” at the same time on your keyboard.

2. Next, add the NodeSource repository for the latest version.

curl -fsSL https://deb.nodesource.com/setup_current.x | sudo -E bash -

*By using setup_current.x, you ensure that you always install the latest available version of Node.js from the NodeSource repository, regardless of whether it’s version 16, 17, or any future release. If version 17 is available, this method will install it automatically.

3. After adding the NodeSource repository, install Node.js and Npm by running the following command:

sudo apt-get install -y nodejs

*This command will fetch the latest version of Node.js and npm from the NodeSource repository.

4. Once the installation is complete, you can verify whether the installation was successful by checking their versions.

node -v
npm -v

*This command will display the installed versions of Node.js and npm.

That’s it! This is how you can install the latest versions of Node.js and npm on Kali Linux!