update node version ubuntu
upgrade node version Ubuntu

Hi Guys, Welcome to Proto Coders point. Here is a quick step by step guide to update nodejs in ubuntu OS.

Time needed: 3 minutes

update node version

  1. use n module

    To upgrade node version in ubuntu will make use of n module from npm package.

  2. Install n module

    Firstly install n module using npm run below command.
    sudo npm cache clean -f
    sudo npm install -g n
    sudo n stable
    …so now we have successfully install n module of npm package.

  3. update node version ubuntu to latest

    Now simply run below command, to upgrade nodejs and to update npm version.
    sudo n latest
    Note: this will update your nodejs and npm version to latest version(not to stable current version).

  4. Now check nodejs version

    run below command
    node --version
    npm --version

  5. Optional – update node to specific version

    curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
    sudo apt-get install --reinstall nodejs-legacy # fix /usr/bin/node

If node --version showing you old version still then simply, close and re-open new terminal and run node --version to check nodejs version updated or no.