NPM-REMOVAL(1)

πŸ“¦
version 1.2.1 Β· 2 versions
, in nixos 26.05, nixpkgs unstable

πŸ’… NPM-REMOVAL(1) β€” the npm-removal page, bestie edition

okay so today we're learning how to say goodbye πŸ‘‹ and honestly? it's giving breakup energy. this is the npm-removal man page, and yes it really is called "Cleaning the Slate" ✨


🌸 NAME 🌸

npm-removal β€” Cleaning the Slate πŸ§ΉπŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

So sad to see you go. 😭

sudo npm uninstall npm -g

Or, if that fails, get the npm source code, and do:

sudo make uninstall

πŸ”₯ More Severe Uninstalling πŸ”₯

Usually, the above instructions are sufficient. That will remove npm, but leave behind anything you've installed. ngl that's kind of the vibe β€” npm dips, your stuff stays 🫢

If that doesn't work, or if you require more drastic measures, continue reading. πŸ‘€ this is the escalation arc, main character energy only.

Note that this is only necessary for globally-installed packages. Local installs are completely contained within a project's node_modules folder. Delete that folder, and everything is gone (unless a package's install script is particularly ill-behaved). πŸ’€ like, unless, okay, some packages are feral.

This assumes that you installed node and npm in the default place. If you configured node with a different --prefix, or installed npm with a different prefix setting, then adjust the paths accordingly, replacing /usr/local with your install prefix. ⭐ literally just swap the path, iykyk.

To remove everything npm-related manually:

rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
⚠️ that's an rm -rf bestie. read it twice. then read it again. πŸ™ˆ

If you installed things with npm, then your best bet is to uninstall them with npm first, and then install them again once you have a proper install. This can help find any symlinks that are lying around:

ls -laF /usr/local/{lib/node{,/.npm},bin,share/man} | grep npm

Prior to version 0.3, npm used shim files for executables and node modules. To track those down, you can do the following:

find /usr/local/{lib/node,bin} -exec grep -l npm \{\} \; ;

(This is also in the README file.) πŸ’–


πŸ‘‘ SEE ALSO πŸ‘‘

  • README
  • npm help uninstall
  • npm help prune

and that's the whole thing, periodt πŸŽ€ this has been NPM-REMOVAL(1) from March 2017 β€” yep, the page and the date both stamped NPM-REMOVAL(1), slay πŸ’œ go forth and uninstall responsibly, ily, bye πŸ¦‹βœ¨

πŸ“¦ where this page comes from