Install Nodejs in GNU/Linux
Table of Contents
Install nodejs in PopOS
PopOS included nodejs already but it was old, so updated version is required.
Step 1: Download Nodejs
Download here, I am downloading Linux Binaries (x64).
Step2: Extract the Binaries:
$ tar -xvf node-v18.16.1-linux-x64.tar.xz
This will extract the file. Check it.
Step 3: Copying the node dir to “/usr/”
# sudo cp -r node-v18.16.1-linux-x64 /usr/
Step 4: Add path to “.bashrc”
sudo nano ~/.bashrc
Append this to the last of bashrc file
export PATH=/usr/node-v18.16.1-linux-x64/bin:$PATH
Restart or update the terminal
$ source ~/.bashrc
Step 5: Check node version:
$ node -v
Updated
sudo apt install nodejs npm
The module n makes version-management easy:
npm install n -g
For the latest stable version:
n stable
For the latest version:
n latest