What is the difference package.json and package-lock.json file in angular?

let’s try to understand with the help of example suppose you are working on the PC1 this PC1 contain your angular project right?

Now you are interested to use the same code in another computer. Let’s say PC2.

When you copy your project and paste into another PC what you need to do next is to perform and fire the npm install.

when you fire npm install what it will do it will download the latest packages which are available from the online, so how the a package and package that a JSON file a works?

your package.json file will contain the version in detail which are installed in computer (PC1) while the package-lock.JSON file will contain all the latest version install in your current PC (PC2).

Leave a Comment