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 the 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
stable

There is this package n which is basically a Node helper, that runs the command to upgrade the 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 the Node.js package you just upgraded or downgraded to like :

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

Next Post

Previous Post

© 2024 Abhinav Singh Dangol

Theme by Anders Norén