NPM stands for Node Package Manager. It is used to install various libraries in our project. NPM is a default package manager for Node Js. It has basically two parts:
- A code repository, where all the code is hosted.
- A command line interface, for downloading the libraries from the online repository.
Installing packages using NPM
What is package.json file?
package.json file is created when we run the npm init command. This file contains all the details of our project like name, version, author, dependencies, description, scripts, license etc.
It is the file which is used by NPM to download the node modules required by your project with the proper version.
What is package-lock.json file?
The contents of the package.json file can be changed, for example if we have updated our packages, then the package.json will contain the latest updates. But the package-lock.json file contains the exact dependencies.