How to update Node to any version using Npm

How to Update Node to Any Version Using Npm

Node.js is very active in the development and you may receive news about the new release almost every month. There are times when we actually need to maintain multiple version of Node with the flexibility to switch between versions without going through the hassle of installation.

Enter Node helper or n.

You need to have at least a node package manager or npm installed in your system.

If you are new to Node and Express then you won’t regret taking our Node course. Its FREE!

Here is what you need to do step by step:

Step 1: Clean npm cache

sudo npm cache clean -f

Step 2: Install node helper (n) globally using the following command.

sudo npm install -g n

Once node helper is installed. You can either get the latest stable version using

sudo n stable

Or if you want specific version like I needed 8.0.0 then you can do this using.

sudo n 8.0.0

After upgrade you can check the latest version of node using

node --version 


node -v.

If you want to switch to the different version of Node, just type n in the terminal and you should see the Node versions listed. Use arrow keys to choose the version and press enter.

Change Node Version

I use this package in production servers too. Works great. Let me know if you use this package too.


Founder of Codeforgeek. Technologist. Published Author. Engineer. Content Creator. Teaching Everything I learn!

Related Posts


  1. hah, thank you for this, I was trying to set up a diff laptop that had an old dev stuff on it…

    ONE THING BTW! you have a typo and need to add a space in the ‘sudo npm install -g n’ 😉

    You’re a rockstar for this article!

  2. Hi,
    After implementing below command I am getting “Error: invalid version ”

    sudo npm cache clean -f
    sudo npm install -g n
    sudo n stable
    “Error: invalid version ”

Leave a Reply to Greg Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.