Prevent iCloud from Syncing /node_modules/ Folder

Update: This was too hard to maintain, and things “got weird” sometimes. I’ve moved to Dropbox instead, very happy.


I have my localhost server on iCloud. Cloud syncing, in my opinion, is the most reliable way to ensure what you’re working on is backedup to the second.

However, 18,000+ file folders like /node_modules/ is just ridiculous to have syncing. I have nothing to prove this, but I’m certain having one or more folders like this would at some point negatively effect syncing and/or indexing.

So, as far as I’ve found the best way to prevent folders like /node_modules/ from syncing is appending .nosync to the end, then symbolically linking to.

This gives you a nice little “Ineligible” tag on your huge folder, and your symbolic link sits there.

To setup, in your project folder, just run

npm install
mv node_modules node_modules.nosync
ln -s node_modules.nosync/ node_modules

Comments

  1. Thank you for the post! You are missing the “_” in nodemodules. It should be:
    npm install
    mv node_modules node_modules.nosync
    ln -s node_modules.nosync/ node_modules

  2. haha, looks like my new markdown parser is running in code blocks causing text between two underscores on the same line to be italic! Thanks for pointing this out!

Leave a Reply

%d bloggers like this: