It is difficult to move an SPFx solution from one folder to another or delete an SPFx solution in the Windows File Explorer. Whenever you try to delete an SPFx solution, it takes forever to calculate the space. It is due to the Node Modules folder which contains more number of files.
SharePoint-2013-Hosting
Well, we all know that npm install <package-name> is used to install a specific module into the SPFx solution. Similarly, npm uninstall <package-name> command is used to remove a specific package from the SPFx solution. It is impossible to uninstall each individual package in the node modules folder separately. Let us see how to remove all the node modules with the help of a single command.

I have been searching for a tool which will help me to remove all the node modules at once. In recent times, I came across this new deletion module called rimraf which was very useful.

Rimraf is a deep deletion module for Node.js. It is an executable that is used to clean the installed node packages in a node based project. Open the Node js command prompt and run the below command for installation of rimraf.

Once installed successfully, it will give the below message.

After installation, navigate to your project folder and execute the below command

Once this command is executed, you can see that the Node Modules folder has been deleted from your solution root folder. Now it is easy for you to archive your solution or remove it, after deleting the node modules.