First check nodejs existing version and after follow these commands on Ubuntu 22.04.2
node -v
v12.xx
Run the following command to remove both libnode72 and nodejs packages:
sudo apt-get remove libnode72 nodejs
Then, clean up any remaining files from the codevious installations using the following command:
sudo apt-get autoremove
Next, update the package list and upgrade all packages on the system using the following commands:
sudo apt-get update
sudo apt-get upgrade
Now, add the NodeSource repository by running the following command:
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
Finally, install the latest version of Node.js using the following command:
sudo apt-get install -y nodejs
Finally, you can verify the installation by checking the version of Node.js using the following command:
node -v
This should show you the updated version of Node.js.
v16.20.0
How can I uninstall an existing Node.js installation and install it again?
Reviewed by kuchsikhamaine
on
14:18
Rating:
No comments: