npm update broke npm

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_14.x | sudo -E bash -
sudo apt-get install -y nodejs

Leave a Comment