DEV Community

Amoghavarsha
Amoghavarsha

Posted on

How To Properly Install NodeJS On Linux

I was trying to debug an error for a couple of hours. Later, I realised I was using an older version of NodeJS which was one among the many dependencies!

Here's how to properly install the current LTS version of NodeJS.
right

# This is an important step
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
Enter fullscreen mode Exit fullscreen mode
sudo apt install nodejs
Enter fullscreen mode Exit fullscreen mode

In case, if you get an overwrite error. Do the following.

sudo dpkg -i --force-overwrite /var/cache/apt/archives/nodejs_18.16.1-deb-1nodesource1_amd64.deb
Enter fullscreen mode Exit fullscreen mode
sudo apt -f install
Enter fullscreen mode Exit fullscreen mode
sudo apt update
Enter fullscreen mode Exit fullscreen mode
sudo apt dist-upgrade
Enter fullscreen mode Exit fullscreen mode

right
Now, you are good to go. Enjoy the latest LTS (Long Term Support) version of NodeJS! 🥳

Top comments (0)