ubuntu update nodejs

  1. Open a terminal window.

  2. Update the package list using the following command: sudo apt update

  3. Upgrade the installed packages to their latest versions: sudo apt upgrade

  4. To ensure compatibility, install the "software-properties-common" package: sudo apt install software-properties-common

  5. Add the Node.js PPA (Personal Package Archive) to the repository list: sudo add-apt-repository -y ppa:deadsnakes/ppa

  6. Update the package list again after adding the new repository: sudo apt update

  7. Install Node.js and npm (Node Package Manager) using the following command: sudo apt install -y nodejs

  8. Verify the installation by checking the Node.js and npm versions: node -v npm -v

This completes the process of updating Node.js on Ubuntu.