Install Node.js from linux tar.gz file

First thing you gone over Node.js’s website and tried to download LTS or the Current version and you managed to extract tar.gz file too. You’re okay until you don’t know what you’re about to do with files that you’ve extracted.

I know I was in the same position, no worries it’s not that hard. Let’s download the most recent LTS version of Node.js, it’s 12.13.1 when I was typing this post. If you face with different version, you can download it or get 12.13.1

Let’s be old school and use our terminal, I guess it’s downloaded in your Downloads folder, right? C’mon let’s navigate there and press a few buttons from our keyboards. (shortcut ctrl+alt+t for terminal)

sudo tar -C /usr/local --strip-components 1 -xzf node-v12.13.1-linux-x64.tar.gz
#To verify our installation:
node --version

If node.js’s website directs you to tar.xz file, change url with tar.gz.

Bonus Content!!
You guys also know you can download it from your terminal using apt? If you’re an Ubuntu user, it cannot be the most recent version, but I know a npm packet called n, it’s great to install any version of node.js you want to!

sudo apt install nodejs -y
sudo npm i -g n
sudo n latest
# or sudo n lts if you want to install LTS version.

If you type “sudo n”, you can navigate between versions 🙂

You may also like...

1 Response

  1. madjid says:

    very useful tahnk you man

Leave a Reply

Your email address will not be published. Required fields are marked *