Actually this problem isn’t only about NodeJS development and the
node_modules folders, but this is where it’s the most pain. It’s more about having any kind of way to download and generate a ton of files within seconds and afterwards waiting for hours, or even days for Dropbox to sync those files. While you actually wouldn’t need it as you could get them instantly again at any later point with one or few small commands.
When installing packages via
npm you sometimes get millions of files and, if you want to keep the folders in sync between different computes, you might think about going with Dropbox. Well, it’s not a good idea. At the time of this writing, Dropbox took almost two days to index and upload all those files to the cloud and was only somewhere half-way through, downloading it on the other machine.
Alternative titles could be:
Ignore files in Dropbox
.gitignore for Dropbox
TL;DR - I went with BitTorrent Sync in the end. And this is how I got there:
A short Google search showed that several people were having the same problem and looking for solutions. The two solutions I liked the most were:
- DropboxIgnore - a small bash script which finds all files, you want to ignore and uses the Dropbox CLI to ignore them. However, Dropbox CLI only works in Linux.
- .dbignore which seems like exactly what I was looking for, but it only works in OS X
Currently I’m synchronizing my MacBook Air and a Linux Laptop together. I could try combining them, but didn’t want to mess up everything. So I kept looking for an alternative…
Than I realized, that BitTorrent Sync actually has an ignore-file. I was so far only using it to sync Pictures and large iso-files, but I gave it a shot. If you get the latest version of BitTorrent Sync, you have to add the folders you want to ignore to
.sync/IgnoreList. If you have version
1.3 or earlier, the file is called
.SyncIgnore and is directly in the folder, you are syncing.
This is what I’ve added to my IgnoreList:
You can find more info on the syntax and everything else in the Sync Help Center.
It scanned my folder with >200,000 files within a minute and started syncing over my local network right after. It took ~half an hour to sync everything locally and is now slowly uploading it to the server.
BitTorrent Sync is a bit difficult to set up compared to Dropbox, as you have to add the folder to every machine you want to use it with, but it works like a charm for now. I also want to add, that I used to have problems with it on Windows, where it just wouldn’t sync anything, but Linux and OS X are working fine.