Abhinav Singh Dangol

Develop | Photograph | Travel

Easy Upgrade and Downgrade Node.js via NPM in Ubuntu

Firstly you need to install Node Package Manager

sudo apt-get install npm

This will basically install the package manager with latest release of Node.js.

If you wish to upgrade or downgrade the Node.js

sudo npm cache clean -f
sudo npm install -g n
sudo n

There is this package  n which is basically a Node helper, that running the command to upgrades node to the latest stable version.

You can specify the version of the node package you want to upgrade or downgrade to as follows:

sudo n 4.4.0

Now you need to create the symbolic link to Node.js package you just upgraded or downgrade to like :

sudo ln -sf /usr/local/n/versions/node//bin/node /usr/bin/node

Next Post

Previous Post

© 2023 Abhinav Singh Dangol

Theme by Anders Norén