To install a specific version of Node.js on Ubuntu 24.04, you can use the NodeSource binary distributions. Here are the steps to do so:
Update your package index:
sudo apt update
Install the required dependencies:
sudo apt install curl software-properties-common
Add the NodeSource repository:
- To install a specific version, such as Node.js 16, use:
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
- To install a specific version, such as Node.js 16, use:
Install Node.js:
sudo apt install nodejs