How to Install NodeJS on Ubuntu?

Update package lists:

`sudo apt update`

Install prerequisites:

`sudo apt install -y curl ca-certificates`

Add NodeSource repository for Node.js LTS:

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

Install Node.js:

`sudo apt install -y nodejs`

Verify installation:

`node -v`

`npm -v`

Suggested for You

Trending Today