# Check the valid version to install as per your Ubuntu distribution on nodesource github # https://github.com/nodesource/distributions?tab=readme-ov-file#ubuntu-versions # Run below commands for installing latest available nodejs from nodesource ppa on Ubuntu 22.04 (latest at the time of writing) curl -fsSL https://deb.nodesource.com/setup_21.x | sudo -E bash - &&\ sudo apt-get install -y nodejs # If running into dpkg errors, follow the advice here https://github.com/nodesource/distributions/issues/1157#issuecomment-1605699451 # sudo dpkg --remove --force-remove-reinstreq libnode72:amd64 # sudo dpkg --remove --force-remove-reinstreq libnode-dev