type node -v if you see node command not found you can go to the installation part.
otherwise if you get a node version, you need to uninstall it.
sudo apt remove nodejs
sudo apt purge nodejs
sudo apt autoremove
after, type which node if the result is node not found you have been removed nodejs from your system.
otherwise if you see a message like /usr/bin/local/node you must delete it with sudo rm -rf /usr/bin/local/node
type which node
/usr/local/bin/node Installed with the official package/usr/local/Cellar/node Installed with brewsudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/local/bin/node_modules
sudo rm -rf /usr/local/bin/npm
sudo rm -rf /usr/local/bin/npx
rm -rf ~/.node
rm -rf ~/.node_modules
rm -rf ~/.npm
rm -rf ~/.npx
brew uninstall node
brew doctor
brew cleanup
brew prune
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | zsh
when install is finish, type bash or zsh (dependent of your shell) to update config files.
install node version 11.11.0 (or latest)
nvm install 11.11.0
nvm use 11.11.0
node -v
11.11.0
Now you can use node npm and npx commands