

Node.js v14, v16, and v18 are available as of the time of writing.įirst, we will install the PPA in order to get access to its packages. These PPAs have more versions of Node.js available than the official Ubuntu repositories. To install a different version of Node.js, you can use a PPA (personal package archive) maintained by NodeSource. Option 2 - Installing Node.js with Apt Using a NodeSource PPA

The next section will show how to use an alternate repository to install different versions of Node.js. This will allow you to install modules and packages to use with Node.js.Īt this point you have successfully installed Node.js and npm using apt and the default Ubuntu software repositories. You can do this by installing the npm package with apt: In most cases, you’ll also want to install npm, the Node.js package manager. If the package in the repositories suits your needs, this is all you need to do to get set up with Node.js. This will not be the latest version, but it should be stable and sufficient for quick experimentation with the language. At the time of writing, the version in the repositories is 12.22.9. Ubuntu 22.04 contains a version of Node.js in its default repositories that can be used to provide a consistent experience across multiple systems. Option 1 - Installing Node.js with Apt from the Default Repositories You can learn how to do this by following the Ubuntu 22.04 initial server setup tutorial. Before you begin, you should have a non- root user account with sudo privileges set up on your system. This guide assumes that you are using Ubuntu 22.04. If you are actively developing Node applications and need to switch between node versions frequently, choose the nvm method. If you need specific newer (or legacy) versions of Node, you should use the PPA repository.

Node.js is a JavaScript runtime for server-side programming.
