How to delete a node_modules folder that was used to install and run a nodejs lite web server when you want to recover the disk space after completing a project.

This has proven problematic on Windows machines in particular. The issue may well get fixed but for the moment this solution works well. The only prerequisite is a copy of 7-Zip. Now, 7-Zip won the “zip wars” many years ago and if you don’t currently have a copy installed then, once you have, you will wonder how you managed without it. It is the programmer’s tool of choice for building and managing compressed files in all of the popular formats.

The download page can be found at https://www.7-zip.org/download.html

Assuming that 7-Zip is installed, right click on the node_modules folder you want to delete. Select 7-Zip from the list and then the “Add to Archive…” option (top of the list).



When the dialogue box is displayed, click the “Delete files after compression” option. Then click the OK button.



7-Zip will then compress and delete the folder and its contents. Delete the node_modules.7z file in the usual way to complete the task.
All done and dusted.