I am working on a React webapp using webpack, loosely alongside this tutorial.
Accidentally, I added the node_modules folder to my git. I then removed it again using
I found the accepted answer does not work in all scenarios. To ensure it 100% works one must ALSO clear the npm cache. Either directly Goto the cache and clear locks, caches, anonymous-cli-metrics.json; or one can try npm cache clean.
Since the author had cleared the cache before trying the recommended solution its possible that failed to make it part of the pre-requisites.