Prefered method of installing nodejs and npm
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - &&
sudo apt-get install -y nodejs
Source: https://github.com/nodesource/distributions/blob/master/README.md
sudo apt-get remove nodejs sudo apt-get remove npm
Download and extract node setup from nodejs.org cp -fR ~/Downloads/setup/node-v18.12.1-linux-x64 ~/.local/
Add path to bashrc export PATH="$HOME/.local/bin:$PATH" source ~/.bashrc