Package.json tracks your project dependencies and serves as the configuration file for NPM. The devDependencies section lists @wordpress/scripts and its version constraints for consistent installations.
Node_modules contains all downloaded JavaScript packages needed by @wordpress/scripts to function. This directory holds the actual code that runs when you execute build commands.
Package-lock.json ensures exact version consistency across installations and deployments. It prevents version drift that could cause different builds on different machines or at different times.