We have not been committing node_modules folder(s) in our application to revision control. Our build processes and developer instructions include running "npm install" manually on an initial check out to install required node modules. Our package.json files detail specific dependency versions.
Recently, our automated builds broke because a down stream dependency broke due to a recent 3rd party commit which I did not think would be possible. Our package.json file is as follows:
{
"name": "test-package",
"description": "Test Package",
"version": "1.0.0",
"license": "UNLICENSED",
"private": true,
"repository": { "type": "svn", "url": "" },
"dependencies": {
"extend": "3.0.0",
"windows-registry": "0.1.3"
}
}
Specifically, our dependency on "windows-registry" version "0.1.3" broke because of a child dependency of that module ("ref" version "1.2.0"). The dependencies from "windows-registry" package.json file are as follows:
"dependencies": {
"debug": "^2.2.0",
"ffi": "^2.0.0",
"ref": "^1.2.0",
"ref-struct": "^1.0.2",
"ref-union": "^1.0.0"
}
I would assume "windows-registry" would always reference version "1.2.0" of the "ref" package, but it was actually pulling in version "1.3.4" and then recently "1.3.5" which broke our builds. I verified in the package.json file for "ref" that it is not version "1.2.0". The package.json file for "ref" is huge and it has lots of values such as "ref@^1.2.0" under various keys within the file. Interesting parts of the package.json file are as follows:
{
/* Lots of other stuff */
"_spec": "ref@^1.2.0",
"version": "1.3.4"
}
Why is NPM not loading the same consistent repeatable dependency graph? Should we be committing node_modules to our revision control?