11cb0ef41Sopenharmony_ci--- 21cb0ef41Sopenharmony_cititle: removal 31cb0ef41Sopenharmony_cisection: 7 41cb0ef41Sopenharmony_cidescription: Cleaning the Slate 51cb0ef41Sopenharmony_ci--- 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci### Synopsis 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciSo sad to see you go. 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci```bash 121cb0ef41Sopenharmony_cisudo npm uninstall npm -g 131cb0ef41Sopenharmony_ci``` 141cb0ef41Sopenharmony_ci 151cb0ef41Sopenharmony_ciOr, if that fails, get the npm source code, and do: 161cb0ef41Sopenharmony_ci 171cb0ef41Sopenharmony_ci```bash 181cb0ef41Sopenharmony_cisudo make uninstall 191cb0ef41Sopenharmony_ci``` 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci### More Severe Uninstalling 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ciUsually, the above instructions are sufficient. That will remove 241cb0ef41Sopenharmony_cinpm, but leave behind anything you've installed. 251cb0ef41Sopenharmony_ci 261cb0ef41Sopenharmony_ciIf that doesn't work, or if you require more drastic measures, 271cb0ef41Sopenharmony_cicontinue reading. 281cb0ef41Sopenharmony_ci 291cb0ef41Sopenharmony_ciNote that this is only necessary for globally-installed packages. Local 301cb0ef41Sopenharmony_ciinstalls are completely contained within a project's `node_modules` 311cb0ef41Sopenharmony_cifolder. Delete that folder, and everything is gone unless a package's 321cb0ef41Sopenharmony_ciinstall script is particularly ill-behaved. 331cb0ef41Sopenharmony_ci 341cb0ef41Sopenharmony_ciThis assumes that you installed node and npm in the default place. If 351cb0ef41Sopenharmony_ciyou configured node with a different `--prefix`, or installed npm with a 361cb0ef41Sopenharmony_cidifferent prefix setting, then adjust the paths accordingly, replacing 371cb0ef41Sopenharmony_ci`/usr/local` with your install prefix. 381cb0ef41Sopenharmony_ci 391cb0ef41Sopenharmony_ciTo remove everything npm-related manually: 401cb0ef41Sopenharmony_ci 411cb0ef41Sopenharmony_ci```bash 421cb0ef41Sopenharmony_cirm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm* 431cb0ef41Sopenharmony_ci``` 441cb0ef41Sopenharmony_ci 451cb0ef41Sopenharmony_ciIf you installed things *with* npm, then your best bet is to uninstall 461cb0ef41Sopenharmony_cithem with npm first, and then install them again once you have a 471cb0ef41Sopenharmony_ciproper install. This can help find any symlinks that are lying 481cb0ef41Sopenharmony_ciaround: 491cb0ef41Sopenharmony_ci 501cb0ef41Sopenharmony_ci```bash 511cb0ef41Sopenharmony_cils -laF /usr/local/{lib/node{,/.npm},bin,share/man} | grep npm 521cb0ef41Sopenharmony_ci``` 531cb0ef41Sopenharmony_ci 541cb0ef41Sopenharmony_ciPrior to version 0.3, npm used shim files for executables and node 551cb0ef41Sopenharmony_cimodules. To track those down, you can do the following: 561cb0ef41Sopenharmony_ci 571cb0ef41Sopenharmony_ci```bash 581cb0ef41Sopenharmony_cifind /usr/local/{lib/node,bin} -exec grep -l npm \{\} \; ; 591cb0ef41Sopenharmony_ci``` 601cb0ef41Sopenharmony_ci 611cb0ef41Sopenharmony_ci### See also 621cb0ef41Sopenharmony_ci 631cb0ef41Sopenharmony_ci* [npm uninstall](/commands/npm-uninstall) 641cb0ef41Sopenharmony_ci* [npm prune](/commands/npm-prune) 65