Excluding specific directory in tar using --exclude
Solution 1:
tar cvfz ../foo.tar.gz --exclude='^./node_modules' .
since --exclude
takes a pattern. It remains to be seen if the '^' as beginning-of-line match is valid for your version of tar
.