I struggle with npm's package.json
and package-lock.json
duality. I believe this question may provide insight regarding how these files relate to each other:
If we define a package.json
file which only specifies exact versions for all dependencies, e.g.:
...
"dependencies": {
"dep1": "1.2.3",
"dep2": "4.5.6"
}
...
and never any ambiguous versions, such as:
...
"dependencies": {
"dep1": "^1.2.3",
"dep2": "4.5.*"
}
...
then would there ever be a reason to also maintain a package-lock.json
file? (And if so, what is such a reason?)
question from:
https://stackoverflow.com/questions/66067402/npm-is-package-lock-json-redundant-if-package-json-only-specifies-exact-version 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…