[Ubuntu](EN) Install latest npm and node.js by using ppa

Set ppa and install latest npm and nodejs on Linux(Ubuntu)


Environment and Prerequisite

  • Ubuntu 16.04 LTS
  • Ubuntu 18.04 LTS
  • Ubuntu 19.04
  • Ubuntu 19.10
  • Ubuntu 20.04 LTS
  • Ubuntu 22.04 LTS


What is PPA?

PPA

PPA is acronym of Personal Package Archive. It is a third party software package repository. There are many packages which are not included in Ubuntu official apt-get.

ppa-homepage


Install npm and nodejs using PPA

Set PPA

First, we need to specify repository(PPA repository). Now 20.x is the latest version of nodejs so I set to 20.x. You can check latest version on https://github.com/nodejs/Release#release-schedule

$ curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -


Install nodejs

Install nodejs

$ sudo apt-get install nodejs -y


Install build-essential

Above nodejs include npm but we need to install build-essential for using better npm.

$ sudo apt-get install build-essential -y


Reference