2

I'm having quite a struggle with moving and deleting the node modules folder or should I say the whole project itself and it took pretty much around half an hour just for 2 projects or so.

Not really sure if it's OS specific or processor specific but I'm on core i5 with 2gb RAM.

I was doing the usual Windows Cut-Copy-Delete and it is fine with large single files such as Zip files and such. Seems related to the number of files since node modules have lots in it.

So I'd like to know if there are other ways to speed it up (like a command line or so? Would they speed up) or is it unavoidable?

NeonNatureEX
  • 487
  • 3
  • 17
  • 1
    No, there isn't really any way. Personally, I have a fairly high specced Linux PC and it also takes ages for me to move my `node_modules` folder. – kognise Mar 25 '19 at 03:09
  • to delete `node_modules`, I use [rimraf](https://www.npmjs.com/package/rimraf), besides that, I never had the need to copy/move that folder or a project folder. – Thomas Mar 25 '19 at 03:14
  • @Thomas Ah, yes. I saw rimraf though. But does it speed up? Moving folders inside the PC doesn't take too long, but if you are copying them into a HDD for backup, that's where the long part comes. – NeonNatureEX Mar 25 '19 at 03:19
  • 7
    Why would you backup `node_modules`? – varun agarwal Mar 25 '19 at 03:26
  • 4
    first, `node_modules` doesn't belong into a backup. 2nd. don't you use some kind of version control? Backing up project folders sounds like the 90's/early 00's – Thomas Mar 25 '19 at 03:28
  • ...wow. You just shed some light into me. Why the heck was I backing up that? ..and yes, I use git and I totally could have added them with .gitignore just as before. Why was I even keeping my projects in a HDD while also uploading to Git though xD Anyhow, I still want to know if someone knows a way to come up with a speedier solution for deleting. – NeonNatureEX Mar 25 '19 at 03:38
  • There is a way to move the **node_modules** folder faster. If you compress the folder, you can move it faster. – Varghese Alex Jul 26 '21 at 15:02
  • Using the command line will speed things up significantly. Windows Explorer operations will try to enumerate all files before acting on them. So, a delete can take a significant amount of time. With PowerShell `Remove-Item .\node_modules\* -Recurse` can be used to more quickly delete the folder. On \*NIX machines `rm -rf node_modules`. For purposes of *moving* this, then zipping the folder would make it 1. small 2. a single file to handle. If space is not an issue, it can be turned into a tar without compression - faster to make/unarchive and it's still a single file. – VLAZ Jul 27 '21 at 14:25
  • 1
    just to be clear, physical backups will never be a BAD idea. "Why was I even keeping my projects in a HDD while also uploading to Git though?" Because it's smart to do so - you don't control github/etc's servers! – Ledivin Jun 23 '22 at 16:38

0 Answers0