Learn how to make the most out of the Dropbox Community here 💙.
Learn how to make the most out of the Dropbox Community here 💙.
Now create the same target node_moduels folder on each of your other systems **AFTER** Dropbox syncs the ENTIRE project direcotry. The old node_modules folder should be removed and the symlink (alias) added before running these steps.
🙂
..sebastian
NOTE: The Initial Post on this thread IS the Solution. While the technique specifically targets the node_modules folder in Javascript / TypeScript projects, it can also be applied to any "folders" that need to be ignored (see bottom of this post for a drag-n-drop technique).
HOW IT WORKS
Because Dropbox does not synchronize folders referened by symlinks (aliases), you can move those folders into a NON-DROPBOX path (outside of dropbox), then create a symlink (alias) in the original Dropbox location.
RESULT
The ignored folder in Dropbox looks and behaves as normal folder, but in reality the data lives in a non-synchronized location on the storage device.
HOW TO IGNORE ANY FOLDER (THE DRAG-N-DROP WAY)
NOTE: Using symlinks/aliases on Windows and Linux should behave the same way, but I have not verified it. Also, I've updated the original post to state that the tiny symlink (alias) file itself "IS" copied to all systems, but not the content of the folder.
..sebastian
Thank you for posting this idea!
The only thing is... where is this working? In OSX Dropbox is still syncing the symlinks.
NOTE: The Initial Post on this thread IS the Solution. While the technique specifically targets the node_modules folder in Javascript / TypeScript projects, it can also be applied to any "folders" that need to be ignored (see bottom of this post for a drag-n-drop technique).
HOW IT WORKS
Because Dropbox does not synchronize folders referened by symlinks (aliases), you can move those folders into a NON-DROPBOX path (outside of dropbox), then create a symlink (alias) in the original Dropbox location.
RESULT
The ignored folder in Dropbox looks and behaves as normal folder, but in reality the data lives in a non-synchronized location on the storage device.
HOW TO IGNORE ANY FOLDER (THE DRAG-N-DROP WAY)
NOTE: Using symlinks/aliases on Windows and Linux should behave the same way, but I have not verified it. Also, I've updated the original post to state that the tiny symlink (alias) file itself "IS" copied to all systems, but not the content of the folder.
..sebastian
I received a response from Tech Support explaining how to use the xattr command in terminal to ignore a file/folder (link below).
Are you a god?
I've been searching for a solution for several years! I wouldn't expect it to be as simple as a symlink. Kudos!
It does not work for me (on Windows). The first npm install is fine, the second run will basically delete the symlink, recreate the directory, add some packages and then fail with a file not found error :(
Hi,
Thanks for the reply! It is the same machine.
It seems to work with yarn though, but I can't switch easily since other people work with the code (and lock file) too.
Symlinks are probably the best general solution. For developers using Git, you have another option. If you are fanatic about creating great git history/commit log for your changes, then you should try using `git worktree add ../projectA-dupe` which will create a duplicate folder that's a sibling to your current git repo. It's actually another "working directory" in proper git terms. It's the same git repo, all the same branches, same stashes, all the git info is the same. Actually the .git dir for "projectA-dupe" basically just points to your original git repo's .git folder. The advantage here, the workflow, is to have your main working directory outside of dropbox entirely, and then add another "working directory" or "worktree" inside your dropbox folder, which will sync. Or, vice versa. You could have the main git repo be inside dropbox, but, setup an npm pre-install hook to fail installation if it sees "Dropbox" is in your current folder path. All developers are instructed to cd to the main git repo inside Dropbox, and then run `git worktree add ../../path/to/your/projectA`. Furthermore, you could have everyone keep their worktree inside dropbox, which means they could all collaborate without ever doing a git push/pull/fetch, by simply allowing dropbox to sync all the git objects. One developer could help another simply by cd'ing to their worktree inside of dropbox. They see the exact same thing, no need to stash changes, commit anything, etc. The symlink might as well be committed into the git repo, and point to a globally reliable path, like ~/universal_node_modules/projectA. Better than all that, probably use yarn v2, and inside .yarnrc.yml set cacheDirectory to be something like ~/Dropbox/.yarn-cache/projectA, so all worktree's can share the same cache.
I've recently implemented dropboxignore which is a simple shell script which facilitates you to generate .dropboxignore files based on your file patterns or even based on existing .gitignore files and ignore matched files from dropbox. Hope to find it useful for your case. Any feedback is more than welcome. dropboxignore is currently available only for Mac OS and Linux.
This is just dumb. No system should ever back up node_modules. This makes me want to rethink my Dropbox subscription.
It's 2021 and Dropbox still has no ignore functionality. I'm wondering how difficult would that be, really. Just before you sync a folder, check for existence of a .dropboxignore file, and then make sure you don't sync the files listed there. Like, seriously. How long can this take to implement? A week? A month? What the f are you waiting for?
Thank you so much! After so much time wasted fiddling with xattr andthe Dropbox selective sync!!
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!