Do I still need a package-lock.json if I am not using caret(^) or tilde(~) in my package.json?

Viewed 508

If I am always using definite versions of packages inside my package.json, what is the need of package-lock.json. Or other way to put this question is , If someone wants to use package-lock.json, why can't they just use definite versions of packages(1.2.3 and not ^1.2.3) inside package.json.

1 Answers

The use of package-lock.json optimize the installation process because the full dependency tree is already calculated :

optimize the installation process by allowing npm to skip repeated metadata resolutions for previously-installed packages. doc

And as @imjared mentionned, definite versions of package can still have dependencies on caret versions.

Related