Uninstall old versions of Node.js (as installed by nvm) while keeping the latest of each major version.
If you have a stinking bonepile of old Node.js versions in your ~/.nvm
folder, this script takes out the trash.
You could install this, but maybe better to...
Run:
npx nvmermind
nvmermind
will keep the latest installed version of each major it finds.
Example: if you have
v14.16.1
andv14.17.0
installed, it will removev14.16.1
and keepv14.17.0
.
nvmermind
will show you:
- what would be removed
- what will be kept
- how much disk space you'll recover
nvmermind
will confirm with you (a human) before blasting anything away.
There's an "API", sure. You can require('nvmermind')
, but I don't feel like documenting it. Maybe next week? There are some docstrings, which is better than nothing.
New in v1.0.0: There are types now; look at those if you want. I'm still not gonna document it.
- Removal uses
nvm uninstall
, which does its thing safely and methodically (read: slowly). nvmermind
accepts no options, arguments, flags, or anything else. There is no man page and no--help
.- This should work on Windows insofar as
nvm
works on Windows.
- I stole some code from Wes Todd's nvmjs. I should probably send a PR.
Copyright © 2021 Christopher "boneskull" Hiller. Licensed Apache-2.0