codekingpro/portable-devtools
114k
1.TH "REMOVAL" "7" "April 2026" "NPM@11.13.0" ""
2.SH "NAME"
3\fBRemoval\fR - Cleaning the slate
4.SS "Synopsis"
5.P
6So sad to see you go.
7.P
8.RS 2
9.nf
10sudo npm uninstall npm -g
11.fi
12.RE
13.P
14Or, if that fails, please proceed to more severe uninstalling methods.
15.SS "More Severe Uninstalling"
16.P
17Usually, the above instructions are sufficient. That will remove npm, but leave behind anything you've installed.
18.P
19If that doesn't work, or if you require more drastic measures, continue reading.
20.P
21Note that this is only necessary for globally-installed packages. Local installs are completely contained within a project's \fBnode_modules\fR folder. Delete that folder, and everything is gone unless a package's install script is particularly ill-behaved.
22.P
23This assumes that you installed node and npm in the default place. If you configured node with a different \fB--prefix\fR, or installed npm with a different prefix setting, then adjust the paths accordingly, replacing \fB/usr/local\fR with your install prefix.
24.P
25To remove everything npm-related manually:
26.P
27.RS 2
28.nf
29rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
30.fi
31.RE
32.P
33If you installed things \fIwith\fR 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:
34.P
35.RS 2
36.nf
37ls -laF /usr/local/{lib/node{,/.npm},bin,share/man} | grep npm
38.fi
39.RE
40.P
41Prior to version 0.3, npm used shim files for executables and node modules. To track those down, you can do the following:
42.P
43.RS 2
44.nf
45find /usr/local/{lib/node,bin} -exec grep -l npm \[rs]{\[rs]} \[rs]; ;
46.fi
47.RE
48.SS "See also"
49.RS 0
50.IP \(bu 4
51npm help uninstall
52.IP \(bu 4
53npm help prune
54.RE 0
55 