in my opinion, the bast way to install Node Js and Npm on Linux and Mac Os system is with some sort of node package manager. in this tutorial we will use nvm, you can follow their tutorial on GitHub or continue with us.

  1. check for updates:

    run the two following commands

    sudo apt update && sudo apt upgrade
  2. run one of the following install script commands

    curl -o- | bash
    wget -qO- | bash
  3. now run these to commands to finish the installation.

    export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
    [ -s "$NVM_DIR/" ] && \. "$NVM_DIR/" # This loads nvm
  4. verify the installation

    command -v nvm
  5. install node

    nvm install node

every thing should be ready by now, for more information please check nvms GitHub.