Put this in your .bash_aliases
or equivalent:
# Stop syncing a node_modules directory (via symlink)
noicloud() {
mv node_modules node_modules.nosync
ln -s node_modules.nosync/ node_modules
}
alias nocloud=noicloud
iCloud ignores files & folders with a .nosync
extension, and also ignores symbolic links. This is the closest work-around I could find to prevent iCloud from having an endless recursive fit about it.