Jan 16 07:16

A brief NPM uninstall headache

It started with create-react-app telling me A template was not provided. This is likely because you're using an outdated version... Quick search and I learned that locally-installed CRA is now a bad idea; suggestion was to uninstall and, in lieu of upgrading, always rely on the npx create-react-app my-app command.

Okay but I tried a simple npm uninstall -g create-react-app and CRA was still local, somehow.

More searching... oho, it was a question of which create-react-app. Mine was in /usr/local/bin, not an npm folder somewhere. This comment got me to realize that I had a bunch of globally-installed packages under the "system" version of Node, back before I installed NVM and started relying on it.

So, nvm use system && npm ls -g --depth=0 told me what those packages were. Now that I was nvm useing the system version of Node instead of the latest, I could do a global uninstall of CRA and it actually disappeared from usr/local/bin.

For good measure, I deleted all the NPM stuff there; it was all years out of date anyway. A different SO answer gave me an awk command to tack on to the prior list command and delete everything at once: npm ls -gp --depth=0 | awk -F/ '/node_modules/ && !/\/npm$/ {print $NF}' | xargs npm -g rm

Fun.


  • npm
  • nvm
  • node
  • create-react-app