What do package.json and npm do?
Options
package.jsonlists dependencies;npminstalls them (Correct option)npmis a database in which packages are storedpackage.jsoncompiles Java code for the backendnode_modulesis a Git branch with the packages
Answer
package.json lists the project's metadata, scripts and dependencies; npm is the tool that installs them into node_modules
Why
Node.js projects (React, build tools) use npm (Node Package Manager), like Maven for JavaScript.
package.json: name, version, dependencies (needed to run), devDependencies (build/test tools) and scripts (npm run build, npm test).
npm install downloads libraries into node_modules (do not commit it) and records exact versions in package-lock.json. Alternatives: yarn, pnpm.
Remember
package.json = manifest. npm install = download dependencies.