With GitLab I can cache node_modules/
and/or I can cache the argument to npm ci --cache <dir>
What's the difference between these two options?
- Should I cache
node_modules/
between jobs and stages in my pipeline? - Should I cache just the
<dir>
provided tonpm ci --cache
- Should I cache both?
The GitLab docs show:
npm ci --cache .npm --prefer-offline
But they don't explain why I would not want to cache node_modules/
.
Size difference:
❯ du -hs .npm
136M .npm
❯ du -hs node_modules
932M node_modules