2025-04-10 14:36:22 -07:00
.TH "REMOVAL" "7" "April 2025" "NPM@11.3.0" ""
2011-11-26 09:21:03 -08:00
.SH "NAME"
2022-12-06 22:18:33 -05:00
\fB removal\fR - Cleaning the Slate
.SS "Synopsis"
2014-09-24 14:41:07 -07:00
.P
2022-12-06 22:18:33 -05:00
So sad to see you go.
2014-09-24 14:41:07 -07:00
.P
.RS 2
2014-11-04 15:08:12 -08:00
.nf
2022-12-06 22:18:33 -05:00
sudo npm uninstall npm -g
2014-11-04 15:08:12 -08:00
.fi
2014-09-24 14:41:07 -07:00
.RE
2011-11-26 09:21:03 -08:00
.P
2024-05-16 05:38:49 -07:00
Or, if that fails, please proceed to more severe uninstalling methods.
2022-12-06 22:18:33 -05:00
.SS "More Severe Uninstalling"
2014-09-24 14:41:07 -07:00
.P
2022-12-06 22:18:33 -05:00
Usually, the above instructions are sufficient. That will remove npm, but leave behind anything you've installed.
2011-11-26 09:21:03 -08:00
.P
2022-12-06 22:18:33 -05:00
If that doesn't work, or if you require more drastic measures, continue reading.
2011-11-26 09:21:03 -08:00
.P
2023-01-16 22:38:23 -05:00
Note that this is only necessary for globally-installed packages. Local installs are completely contained within a project's \fB node_modules\fR folder. Delete that folder, and everything is gone unless a package's install script is particularly ill-behaved.
2011-11-26 09:21:03 -08:00
.P
2022-12-06 22:18:33 -05:00
This 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.
2011-11-26 09:21:03 -08:00
.P
2022-12-06 22:18:33 -05:00
To remove everything npm-related manually:
2014-09-24 14:41:07 -07:00
.P
.RS 2
2014-11-04 15:08:12 -08:00
.nf
2022-12-06 22:18:33 -05:00
rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
2014-11-04 15:08:12 -08:00
.fi
2014-09-24 14:41:07 -07:00
.RE
2011-11-26 09:21:03 -08:00
.P
2022-12-06 22:18:33 -05:00
If you installed things \fI with\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:
2014-09-24 14:41:07 -07:00
.P
.RS 2
2014-11-04 15:08:12 -08:00
.nf
2022-12-06 22:18:33 -05:00
ls -laF /usr/local/{lib/node{,/.npm},bin,share/man} | grep npm
2014-11-04 15:08:12 -08:00
.fi
2014-09-24 14:41:07 -07:00
.RE
2011-11-26 09:21:03 -08:00
.P
2022-12-06 22:18:33 -05:00
Prior to version 0.3, npm used shim files for executables and node modules. To track those down, you can do the following:
2014-09-24 14:41:07 -07:00
.P
.RS 2
2014-11-04 15:08:12 -08:00
.nf
2022-12-06 22:18:33 -05:00
find /usr/local/{lib/node,bin} -exec grep -l npm \[ rs]{\[ rs]} \[ rs]; ;
2014-11-04 15:08:12 -08:00
.fi
2014-09-24 14:41:07 -07:00
.RE
2022-12-06 22:18:33 -05:00
.SS "See also"
2014-09-24 14:41:07 -07:00
.RS 0
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help uninstall
2022-12-06 22:18:33 -05:00
.IP \(bu 4
2019-11-18 21:01:39 +02:00
npm help prune
2022-12-06 22:18:33 -05:00
.RE 0