You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
sebastian_
5 years agoCollaborator | Level 8
How to make Dropbox ignore node_modules folder with symbolic links (aliases)
PROBLEM
Dropbox does not currently provide an ignore file/folder feature that enables a locally-unique instance to exist on each machine. One important use of this is the “node_moduels" folder ...
- 5 years ago
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)
- Move the folder to ignore "Outside of Dropbox" into another location (e.g. ~/Documents)
- In Finder (Mac OS), Command+Option Drag the folder back into Dropbox to create an alias. The cursor should turn into a little curved arrow while dragging if you have the right keys pressed. Once dropped, an alias will be created in the original Dropbox location pointing to the moved folder.
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
sebastian_
Collaborator | Level 8
lkljsjjjsjj, Glad to hear it works for you!! I too pulled my hair out for years before figuring this configuration out.
Arne1, Sorry to hear it isn't easily translating to Windows. Is the "second run" failure happening on the same system, or on a secondary system? I no longer have access to a Window platform or I'd be happy to troubleshoot it.
- Windows Secondary System: “Theoretically", Dropbox should sync the symlink/alias file itself to all clients subscribed to the same Dropbox/share. Once the symlink/alias file itself is sync'd to your other system(s), you need to create the exact same target folder path (e.g. "C:\users\your_username\downloads\node_modules_for_projectname\node_modules").
- Windows Secondary Run (on same system): "Theoretically" NPM should behave the same, regardless of platform, but maybe not. Have you tried yarn? What do the commands do after creating the node_modules symlink=>downloads_folder?
- yarn install
- yarn upgrade --latest
Unfortunately, I do not know the behavior of symlinks in cross-platform implementations (e.g. Mac Dropbox syncing w/ Windows and/or Linux Dropboxes).
** Can someone working with NPM on Windows help with a “Working and Tested” set of steps for Windows and post back? **
Arne1
5 years agoExplorer | Level 4
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.
- Arne15 years agoExplorer | Level 4
After switching to yarn, I've noticed that composer (the PHP package manager) also doesn't like if its directory ("vendor" in this case) is a symlink.
So at the moment, this trick does not work with NPM or composer. :tired_face:
- sebastian_5 years agoCollaborator | Level 8
Arne1 , That's a bummer. I’ve definitely seen various commands on the toolchain not respecting symlinks and takes a bit of effort to figure it out. You might consider posting a question to the tool's project page asking for help getting symlinks working. If/When you find a workaround for your toolchain, please post it back here to help the rest of the developer community.
Until we have a .dropboxignore (a “true ignore”, without reindexing), sharing workarounds (hacks) are the only course of action. If a .dropboxignore feature existed, I’d put far more of my projects into Dropbox.
- Terry U.15 years agoExplorer | Level 4
Ao I removed all node_modules folders on both my iMac and actually from within my Dropbox account.
However, since then my Dropbox won't complete, it has been on day after day and disabled sleep. It is stills tuck on 500K files. I had a very similar incident on my Macbook Pro when I removed a load of files via Selective Sycn and this too over a month to resolve, having to leave the machine on full time during this period without sleep. So, how can I resolve this.
At the moment, Dropbox is unusable. I am close to finding another provider who does sync files effectively, something that Dropbox was great at it, in it's early days. Now it seems to struggle with the basics of Syncing. Instead adding useless features like connecting Google Calendar and Outlook.... Why not focus on the core functionality of the syncing and ignoring of files. having been a paid subscriber since 2012 it is with disappointment and regret I am faced with having to look to another provider.
About View, download, and export
Need support with viewing, downloading, and exporting files and folders from your Dropbox account? Find help from the Dropbox Community.
Need more support
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!