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