user image

Mohamed Aboelfotoh
Published in : 2022-02-11

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 Date : 2022-02-11

Best answers

51

Best answers

51

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 Date : 2022-02-11

Best answers

4

Best answers

4

Got it! I’m so grateful!

Shilpa Date : 2022-02-26

Best answers

10

Best answers

10

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.

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

How to open URL in new tab & focus on it in Javascript?
Publish date: 2021-12-22 | Comments: 1

Tag: Javascript

JAVASCRIPT: How do I add another key to object?
Publish date: 2022-03-06 | Comments: 3

Tag: Javascript

Simple HTML date picker is showing not showing calendar icon!
Publish date: 2022-03-01 | Comments: 2

Tag: Javascript

Javascript: Filtering arrays by it properties?
Publish date: 2022-03-05 | Comments: 1

Tag: Javascript

Help: How do I loop simple JSON objects to iterate all keys and values itself?
Publish date: 2022-03-06 | Comments: 1

Tag: Javascript

How select specific tag in jQuery using if else statement?
Publish date: 2022-02-27 | Comments: 1

Tag: Javascript

jquery undefined function
Publish date: 2022-02-28 | Comments: 1

Tag: Javascript