Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 526
Krupanand Shetty Avatar asked Jan 30 '26 15:01

Krupanand Shetty


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.

like image 163
Gabriel Bleu Avatar answered Feb 01 '26 08:02

Gabriel Bleu