how to ignore all the node_modules folders from time machine
I'm one of the maintainers of Asimov, a free macOS utility for automatically excluding development dependencies (npm, Composer, RubyGems, and more). It was designed for this very purpose ::looks begrudgingly at node_modules/::
The easiest way to install Asimov is via Homebrew (brew install asimov), but the GitHub repo also has manual installation instructions. Once installed, a cron job runs every day to find development dependencies and automatically exclude them from Time Machine via tmutil (mentioned above).
One more benefit is that Asimov checks for the dependency declarations (in the case of node_modules/, a package.json file) before excluding the directory from backups.
Hope it helps!