Issue
I just did a git commit and it deleted a few files seemingly randomly from my node_modules folder. Has anyone had this issue?
To be clear, my latest git commit deleted
delete mode 100644 node_modules/grunt-google-cdn/node_modules/google-cdn/node_modules/cdnjs-cdn-data/external/cdnjs.json
delete mode 100644 node_modules/grunt-node-inspector/node_modules/node-inspector/front-end-node/Images/src/favicon.eps
delete mode 100644 node_modules/moment/min/tests.js
delete mode 100755 node_modules/requirejs/bin/r.js
I’ve never seen this before and I can’t begin to understand why this happened. This prevents me from building my app for deployment. Does anyone know how/why this happened and how this can be prevented in the future?
Solution
My expectation is that those files were deleted at some point (via what mechanism, I can’t say).
If you’re using Git 2.0 or greater, when you typed git add .
, you staged the deleted files for commit. git add .
basically says “I want to stage all of the changes in this repo”, which in this case included deleting files.
The behavior was different in prior versions (I just validated different behavior against Git 1.9 and 2.6.3).
Answered By – Daniel Mann
Answer Checked By – Mildred Charles (AngularFixing Admin)