updating node js ubuntu

To update Node.js on Ubuntu, follow these steps:

  1. Open the terminal: You can do this by pressing Ctrl+Alt+T or by searching for "Terminal" in the applications.

  2. Update the package lists: Run the following command to update the package lists from the repositories:

sudo apt update
  1. Install Node.js using NodeSource: NodeSource provides a repository that contains the latest version of Node.js. Run the following command to add the NodeSource repository:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
  1. Install Node.js and npm: Run the following command to install Node.js and npm:
sudo apt install -y nodejs
  1. Verify the installation: To verify that Node.js and npm are installed correctly, run the following commands to check their versions:
node -v
npm -v
  1. Update npm (optional): If you already have npm installed, you can update it to the latest version by running the following command:
sudo npm install -g npm

That's it! You have successfully updated Node.js on your Ubuntu system.