• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2section: using-npm
3title: removal
4description: Cleaning the Slate
5---
6
7# removal(7)
8
9## Cleaning the Slate
10
11### Synopsis
12
13So sad to see you go.
14
15```bash
16sudo npm uninstall npm -g
17```
18
19Or, if that fails, get the npm source code, and do:
20
21```bash
22sudo make uninstall
23```
24
25### More Severe Uninstalling
26
27Usually, the above instructions are sufficient.  That will remove
28npm, but leave behind anything you've installed.
29
30If that doesn't work, or if you require more drastic measures,
31continue reading.
32
33Note that this is only necessary for globally-installed packages.  Local
34installs are completely contained within a project's `node_modules`
35folder.  Delete that folder, and everything is gone less a package's
36install script is particularly ill-behaved).
37
38This assumes that you installed node and npm in the default place.  If
39you configured node with a different `--prefix`, or installed npm with a
40different prefix setting, then adjust the paths accordingly, replacing
41`/usr/local` with your install prefix.
42
43To remove everything npm-related manually:
44
45```bash
46rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
47```
48
49If you installed things *with* npm, then your best bet is to uninstall
50them with npm first, and then install them again once you have a
51proper install.  This can help find any symlinks that are lying
52around:
53
54```bash
55ls -laF /usr/local/{lib/node{,/.npm},bin,share/man} | grep npm
56```
57
58Prior to version 0.3, npm used shim files for executables and node
59modules.  To track those down, you can do the following:
60
61```bash
62find /usr/local/{lib/node,bin} -exec grep -l npm \{\} \; ;
63```
64
65(This is also in the README file.)
66
67### See also
68
69* [npm uninstall](/cli-commands/npm-uninstall)
70* [npm prune](/cli-commands/npm-prune)
71