You probably have npm installed twice, one is in /usr/local/bin
and the other in /usr/bin
.
First, you can try to remove the npm
module that has been installed by upgrading npm
. Try to run this:
rm -r /usr/local/lib/node_modules/npm
/usr/bin/npm uninstall npm
Once you have a running version of npm, install a more recent version of node before upgrading npm. Then, remove the version of your linux distribution.
If the first solution doesn't work, another approach is to install a recent version of node (without using npm of course):
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…