My react app is showing two package.json and package-lock.json.
Intially it only has one package.json when i creat react app using npx create-react-app, but it adds another package whenever i install any dependencies.
Above-mentioned is the image of the file
Why is it showing two packages and what are the effects on the app
Building package-lock.json is part of building the application. You update package.json either manually or via npm commands to tell node what packages and versions to include, package-lock.json is an artifact of it actually doing that.
The indentation of the files is hard to tell in the image but I’m pretty sure they are not in the same folder.
You have node_modules, package.json, package-lock.json in the api-1 folder and also in the folder above it (so inside the ../api-1 folder, so in the API APP1 folder).
Edit: Just to explain. When you run npm in a folder that folder is the “root” for the command. So you can run it in different folders