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

46

Best answers

46

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 toggle ( show and hide ) divs according to day hours?
Publish date: 2022-02-13 | Comments: 1

Tag: Javascript

Adding an id number at the first index to an array of objects
Publish date: 2022-02-13 | Comments: 1

Tag: Javascript

How do I check if an array includes a value in JavaScript?
Publish date: 2022-02-13 | Comments: 2

Tag: Javascript

How can I switch between two background-colors using js setinterval( )
Publish date: 2022-02-22 | Comments: 1

Tag: Javascript

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

Tag: Javascript

JavaScript variable for Changing CSS Height
Publish date: 2022-02-12 | Comments: 1

Tag: Javascript

javascript: Uncaught TypeError: undefined is not a function
Publish date: 2022-03-02 | Comments: 2

Tag: Javascript