node.js – npm tries to install other version of node than selected by nvm
It seems you have an old version of node on your system, which wasn’t installed by nvm (but probably the package manager if your system). And this version seems to be the first one to be found in your path.
Use which node to find the respective executable and try to get rid of this version. As you seem to be on Ubuntu you could try
sudo apt remove nodejs npm
Which should remove a nodejs/npm installed by apt. If that doesn’t uninstall anything, you have to investigate further where the old node version comes from
Read more here: Source link
