Exclude .git file and node_modules directory
$ zip -r9 [target_file] [source_file] -x *.git* node_modules/\*
Exclude .git file and files in node_modules directory, but keep node_modules directory
$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\*
Number parameter means degree of compression. -9 is the most optimal but the slowest compression. If -0 is given, there will be no compression. Default level is -6.
** means to adapt exclusions recursively inner directories. \* is an escaped wildcard to avoid path expansion.
@se468 thanks for the info, couldn't figure out why I was getting that error. For my specific case I zipped a folder containing multiple subfolders that contained
node_modulesand used the following command