user

Mohamed Aboelfotoh

11 Feb 2022

What is the use of package-lock JSON file?

Javascript

When I install a new NPM package, I find 2 JSON files in the project's folder, a package file and a package-lock file.

I know the use of the package file where I can find all my dependencies and also where the entry point which the project will be built from.

But I don't know the package-lock file, and weather I have to play with it or not.

Would you please help me with that?

 

 

Comments

Mohamed Atef

11 Feb 2022

Best Answer

best answer
githubgithubgithub

Package.json file contains the main names of packages & libraries which you installed and you can edit it, but Package-lock.json contains the details of each package and the link of repository of each package (consider it's the details of the packages which came from package.json)

Mohamed Aboelfotoh

11 Feb 2022

github

Got it! I’m so grateful!

Shilpa

26 Feb 2022

github

Package-lock.json keeps track of the exact versions of every package which you are installing, so another machine can reproduce the same packages and run the application without versioning issues.

© 2024 Copyrights reserved for web-brackets.com