Upgrade NodeJS on Ubuntu

Here are the steps you can follow to upgrade NodeJS on an Ubuntu system.

sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* ~/.npm
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/bin/node*
sudo rm -rf /usr/local/include/node*

sudo apt-get purge nodejs npm
sudo apt autoremove

Download the latest installable archive for your OS from https://nodejs.org/en/download/

tar -xf your-archiveFile
sudo mv extracted-archiveFolder-name/bin/* /usr/local/bin/
sudo mv extracted-archiveFolder-name/lib/node_modules/ /usr/local/lib/
node -v
#should display the latest version of node

Kj
Kj [/.] Sreekumar programs computers as a hobby and profession. Into programming from his school days, Sree uses Codemarvels to key in facts and fixes he finds interesting while working on different projects. Some of the articles here give away a few shades of his philosophical leanings too.

Leave a Comment

Your email address will not be published. Required fields are marked *